Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

share|improve this question
Did you figure it out eventually? Also did you check the limit for other processes? – HRJ Oct 5 '13 at 19:48

It seems memcached process is started by mysql user. Try to explicitly add rules in limits.conf to this user (* should apply to all users except root, but it doesn't cost much to try...).

mysql            soft    nofile          10240
mysql            hard    nofile          10240

Also I think those limits are only applied if PAM loads them. Check if you have the following line in /etc/pam.d/common-session

session required

If not add it at the end. After this you may need to reboot to see the changes applied.

share|improve this answer
I did the mentioned steps 1) adding mysql line to limits.conf 2) added to common-session file 3) rebooted the box, still the cat /proc/<pid of memcached>/limits is showing 1024 as max open files, i am trying this on ubuntu 12.10. Please let me know if there is anything else I can try to increase max open files for memcached service – targetsmart May 24 '13 at 3:03

Your Answer


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.