Ubuntu – how to increase maximum open files for memcached service

pamulimit

Using ulimit -n i am able to set per shell based maximum open files limit

To make this value persistent i am able to edit this is in /etc/security/limits.conf and restart the ubuntu 12.10 box, here is the configuration

*               soft    nofile          10240
*               hard    nofile          10240
root            soft    nofile          10240
root            hard    nofile          10240

but the above value is not getting applied to memcached service, how to make "max open files 10240" to memcached service.

even after setting limits.conf the memcached is still showing

xx@xx:~$ ps aux|grep mem
mysql     2044  0.0  0.0 327436  1260 ?        Sl   17:09   0:00 /usr/bin/memcached -vv -m 256 -p 11211 -u mysql -l 0.0.0.0

xx@xx:~$ cat /proc/2044/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             30402                30402                processes
Max open files            1024                 1024                 files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       30402                30402                signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us

please let me know how to increase "max open files" for memcached service

Best Answer

In the memcache config set the max open connections using:

-c 10240

You can check if this is actually necessary or not by checking on listen_disabled_num when running:

echo stats | nc localhost 11211

You should see that value above 0 if max connections are an issue.

Related Question