Client usage / best practices

57 views
Skip to first unread message

Ryan LeCompte

unread,
Jun 18, 2008, 9:07:26 AM6/18/08
to spymemcached

Hello,

I wrote a simple test program that involved spawning off 5 threads to
read 1000 random entries from three memcached instances. When each
thread has its own memcached client instance I noticed that
performance is better than when I make all 5 threads use a single
memcached client instance. Is this expected? Is the standard practice
to use a single spy memcached cient instance that is shared across
threads or to have multiple client instances per thread?

Thanks,
Ryan

Dustin

unread,
Jun 18, 2008, 1:22:33 PM6/18/08
to spymemcached
It's not really expected, but it's not terribly surprising. There
are a few reasons it might be faster. One is that it bypasses TCP
congestion control. That might do it. Also, if you're really
hammering on on the client and have multiple cores, you could be
saturating a CPU with the thread performing IO. It also may be trying
optimizing too aggressively and introducing latency in doing so.

There's probably a number that's optimal for your app. Too many
will definitely be slower. Depending on your needs, too few sounds
like it might be marginally slower.

Of course, this can be fixed in the client. It can multiplex
multiple connections to bypass TCP congestion control, use multiple
threads internally to deal with decoding results, etc...

Ryan LeCompte

unread,
Jun 18, 2008, 2:45:46 PM6/18/08
to spymem...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages