Using libmemcache in a multi-threaded application

Ladar Levison ladar at nerdshack.com
Wed Dec 6 09:26:14 UTC 2006


A general question for the list.

I'm trying to integrate libmemcache into a multi-threaded application, 
and I'm looking for some pointers on how to do that? On a side note, is 
it possible to "weight" servers with libmemcache, such that if I have 
one memcached server with 2 GB, and another with 4 GB, the 4 GB server 
gets twice the number of objects?

In poking through the library, I noticed it uses a global context to 
track information. Will that be a problem if multiple threads are using 
the library? Does each thread need its own memcache struct, or can they 
share?

I didn't see and semaphores or mutexes in the code, so I'm worried. I 
also couldn't find any discussion of this on this list, or through Google.

Thanks in advance.

Ladar



More information about the memcached mailing list