As you may know, when using memcached on 32-bit servers, processes can only address 4GB of virtual memory making the memcached daemon handle only 2 or 3 Gb of memory.
If you want to address more memory, you need to launch multiple memcached daemons.
I wrote an rc script , mmemcached, for FreeBSD to manage this.
To use it, you need to add this in /etc/rc.conf:
mmemcached_enable="YES" mmemcached_servers="1 2" mmemcached_user="nobody" mmemcached_args="-c 8192 -t 2 -m 2048 -d"
Copy the mmemcached script in /usr/local/etc/rc.d for example and launch it with the start argument. With the above configuration it will launch two memcached daemons listening on ports 11211 and 11212 (mmemcached_servers parameter) with 2Gb of memory.
Configuration
Details of the rc.conf configuration:
- mmemcached_enabled: let this script “startable”,
- mmemcached_servers: List of the daemons you want to start. Each number is used to generate the port number of the daemon. For example, 2 will launch a daemon listening on port 11212,
- mmemcached_user: user that will start the daemon,
- mmemcached_args: flags to pass to the daemon.
Download
Download the script on github.
Pingback: ProjectX Blog » Blog Archive » Xlinks Digest - 06 / 10 / 2008()