memcached configuration

Marcus Bointon marcus at
Mon May 14 16:33:01 UTC 2007

On 14 May 2007, at 17:19, Paul Cowan wrote:

> <memcache>
>       <memcached host="" port="11211" weight="2" />
>       <memcached host="" port="11212" weight="5" />
> </memcache>
> Could somebody explain why there are 2 <memcached> elements both  
> pointing to the same I.P. address but with different ports.
As it stands it makes very little sense! If they were completely  
separate then it might be that you were storing different kinds of  
data in each and you perhaps wanted to be able to clear either  
without affecting the other. But here they are set up as a weighted  
pair. The only reason I can think of for doing this is that it's a  
testing setup where you want to make sure that your client is talking  
to 2 servers correctly, and that the weightings are working correctly  
> Also what would influence my choice of ports and finally what is  
> the weight attribute used for?
Ports are entirely arbitrary, and related to what you want/need to  
open on your firewall. By default memcached runs on port 11211. The  
weight is just a biasing factor - if you had two servers, one with  
1Gb for memcached, and another with 2Gb, you might assign them  
weights of 1 and 2 respectively, so that 2/3 of the data goes on the  
server with more space.

Marcus Bointon
Synchromedia Limited: Creators of
UK resellers of info at hand CRM solutions
marcus at |

More information about the memcached mailing list