From: Alexey Morsov <samurai@ricom.ru> To: ALT Devel discussion list <devel@lists.altlinux.org> Subject: [devel] patch for libmemcache Date: Mon, 8 Sep 2008 17:40:47 +0400 Message-ID: <20080908134047.GC28253@ricom.ru> (raw) [-- Attachment #1.1: Type: text/plain, Size: 1019 bytes --] Приветствую. Господа гуру, хотелось бы что бы посмотрели вы на патч один к libmemcache. Я тут озадачивался (собирал cmemcache себе на ALS4) и там предлагалось данный патчик на libmemcache ставить ) http://gijsbert.org/downloads/cmemcache/libmemcache-1.4.0.rc2.readme У меня оно вроде работает (apache2+wsgi memcached django), но сайт не разу не нагружен потому и проверить толком не могу (ну ab2 чуть натравил да и все). -- WBR, Alexey Morsov программист ЗАО "ИК "Риком-Траст" Jabber: samurai@www.fondmarket.ru ALT Linux Team Member [...] я не верю, что те, у кого серверы на Sisyphus, сделали это нечаянно. Иногда это взвешенный и оцененный риск. -- mike in devel@ [-- Attachment #1.2: libmemcached.patch --] [-- Type: text/plain, Size: 3683 bytes --] diff --git a/libmemcache/src/memcache.c b/libmemcache/src/memcache.c index 227758d..b927b40 100644 --- a/libmemcache/src/memcache.c +++ b/libmemcache/src/memcache.c @@ -978,17 +978,17 @@ mcm_err(const struct memcache_ctxt *ctxt, const u_int32_t flags, const char *fun int mcm_err_filter_add(struct memcache_ctxt *ctxt, const u_int32_t err_mask) { - if ((ctxt->MCM_ERR_MASK & err_mask) == ctxt->MCM_ERR_MASK) + if ((ctxt->MCM_ERR_MASK & err_mask) == err_mask) return 0; - ctxt->MCM_ERR_MASK &= err_mask; + ctxt->MCM_ERR_MASK != err_mask; return 1; } int mcm_err_filter_del(struct memcache_ctxt *ctxt, const u_int32_t err_mask) { - if ((ctxt->MCM_ERR_MASK & err_mask) == ctxt->MCM_ERR_MASK) + if ((ctxt->MCM_ERR_MASK & err_mask) == 0) return 0; ctxt->MCM_ERR_MASK &= ~err_mask; @@ -1131,6 +1131,9 @@ mcm_fetch_cmd(struct memcache_ctxt *ctxt, struct memcache *mc, struct memcache_r /* Even though we haven't sent the request, mark the response as * having been attempted. */ res->_flags |= MCM_RES_ATTEMPTED; + /* This res might have been used before, so reset found flag */ + res->_flags &= ~MCM_RES_FOUND; + /* While we're looping, might as well see if we should be auto * deleting any of these keys. */ diff --git a/libmemcache/test/benchmark/benchmark.c b/libmemcache/test/benchmark/benchmark.c index 259f7ca..b6e6c21 100644 --- a/libmemcache/test/benchmark/benchmark.c +++ b/libmemcache/test/benchmark/benchmark.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) { tests = strdup(argv[3]); if (tests == NULL) - tests = strdup("adgs"); + tests = strdup("adgGs"); if (valsize == 0) valsize = 50; @@ -138,6 +138,30 @@ main(int argc, char *argv[]) { printf(fmt, "get", num_tests / tt(&t1, &t2), tt(&t1, &t2), tt(&t1, &t2) / num_tests); } + /* same get benchmark, but with overhead for each request. */ + if (strchr(tests, (int)'G') != NULL) { + /* BEGIN get request */ + if (gettimeofday(&t1, NULL) != 0) + err(EX_OSERR, "gettimeofday(2)"); + + for (i = 0; i < num_tests; i) { + req = mc_req_new(); + res = mc_req_add(req, key, keylen); + res->size = valsize; + res->val = malloc(res->size); + mc_res_free_on_delete(res, 1); + + mc_get(mc, req); + mc_req_free(req); + } + + if (gettimeofday(&t2, NULL) != 0) + err(EX_OSERR, "gettimeofday(2)"); + + /* END get test */ + printf(fmt, "fget", num_tests / tt(&t1, &t2), tt(&t1, &t2), tt(&t1, &t2) / num_tests); + } + if (strchr(tests, 'a') != NULL || strchr(tests, 'd') != NULL) { diff --git a/libmemcache/test/regress/regress.c b/libmemcache/test/regress/regress.c index 71b4cfe..7d8df87 100644 --- a/libmemcache/test/regress/regress.c +++ b/libmemcache/test/regress/regress.c @@ -33,6 +33,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <assert.h> #include <memcache.h> @@ -70,8 +71,14 @@ main(int argc, char *argv[]) { num_tests = 10; mc = mc_new(); - mc_err_filter_del(MCM_ERR_LVL_INFO); - mc_err_filter_del(MCM_ERR_LVL_NOTICE); + + /* test filter add/del and make sure info and level are NOT filtered out */ + assert(mc_err_filter_del(MCM_ERR_LVL_INFO) == 0); + assert(mc_err_filter_del(MCM_ERR_LVL_NOTICE) == 0); + assert(mc_err_filter_add(MCM_ERR_LVL_NOTICE) == 1); + assert(mc_err_filter_add(MCM_ERR_LVL_NOTICE) == 0); + assert(mc_err_filter_del(MCM_ERR_LVL_NOTICE) == 1); + assert(mc_err_filter_get() == 0); if (mc == NULL) err(EX_OSERR, "Unable to allocate a new memcache object"); [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 489 bytes --]
reply other threads:[~2008-09-08 13:40 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080908134047.GC28253@ricom.ru \ --to=samurai@ricom.ru \ --cc=devel@lists.altlinux.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Team development discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \ devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru public-inbox-index devel Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.devel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git