Concurrency control and configuration parameters of memcached
pokharnaabhishek at yahoo.co.in
Fri Sep 8 06:59:07 UTC 2006
Memcache is really easy and efficient. It is actually a fast cache implementation I have come across in comparison to others. Gr8 work!
I have two queries regarding memcache(Java version) environment setup. :-
1. I am going to put memcache onto production environment. We have a CentOS 4.3 i686 - v3.1.0, with dual processors and 2 GB RAM; We will be running memcache server on one of them, what is the ideal configuration of memcache on such a server? Shud I run memcache on its full server capacity ie. 2 GB or less than that? What shud the SocketIO Pool config have? I mean are there any pre - defined config paras for it which are best suited for such servers? (The servers here wud be handling a lot of load ie. 10K hits on app server which in turn will hit memcache for data. Per hit = 10-12 hits on memcache).
2. I am having 2 application servers on which I am accessing same Memcache Server.
Suppose, If both the servers want to access and modify the same object from memcache, is there any way to restrict one of the servers from accessing or modifying that object until the first server is done with that object. How do I control such a concurrency problem?
Consider this situation:-
A list with numeric values: 1,2,3
Server1: Gets the list from memcache.
Server2: Also gets the list from memcache.
Server1: Removes '1' from the list.
Server2: Removes '3' from the list.
Server1: Puts back a list with 2,3 in list in memcache.
Server2: Puts back a list with 1,2 in list in memcache.
Note:Since, both servers have their instance of list objs.
This is not what we need to do. Becoz, both servers are putting an incorrect list in memcache.Ideally what shud have happened was that in the end a list with only '1' shud be put back in memcache. This problem occurs under load and happens in case of concurrent threads.
What I want is that memcache shud restrict Server2 and a consistent list shud be there in memcache. How do I handle such problem in memcache environment?? I know we can handle at application server end by doing all these operations through a centralized place(gets and puts), but how do I handle it in Memcache????
Any help wud be appreciated?
Find out what India is talking about on - Yahoo! Answers India
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the memcached