Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got memcache running on 5 web servers all of which are on the host list in php and which are load balanced on the front end. So since memcached is supposed to be distributed the php client will decide which node to write key/value pairs to and keep a record for later retrieval from that same node right?

Or is the php client code not smart enough to do that and rather it writes the data to all the servers and then randomly pics one from the pool to read from?

But if it does that; write to all instances in the host list / pool; then what is the purpose for a tool like http://repcached.sourceforge.net/ which replicates data for redundancy.

Reason I ask is because all the load balanced servers are running it and if it does indeed write to all the servers in the pool then it seems like it defeats the purpose of it being distributed and so I should just force php to pull from the host in the hostlist that is localhost.

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

Memecache library is responsible for sending the request to the correct server. The library uses the list you provide to send requests to different servers and memcache doesn't do replication.

Refer to the Linux journal article. It explains how memcache works in more detail. http://www.linuxjournal.com/article/7451?page=0,1

share|improve this answer
    
Great article just what I needed, thanks Sameer. I also found this one that was extremely helpful: code.google.com/p/memcached/wiki/NewConfiguringClient –  Mike Dec 10 '10 at 11:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.