• >

Set ulimit parameters on ubuntu

By ivanov | Published: June 4, 2009
Add to pdf

By default the number of open files  pro user in Ubuntu 8.04   is 1024. In my case this number was  too small so I have to increase it.This is done with the  ulimit command:

$ulimit -a   # see all the kernel parameters
$ulimit -n   #see the number of open files
$ulimit -n 9000  #  set the number open files to 9000

The problem with this way is that the ulimit parameter is only set currently  for this command terminla and user.If you open a new tab and type again ulimit -a you will see that the number of open files is 1024.This means that after a reboot you’ll need to set the parameter again.

First, in order to set this options automatically  you have to edit the etc/security/limits.conf file.

$sudo gedit /etc/security/limits.conf    #open the file in gedit

The # means that this part is commented.The wildcard * means  for all users.We need to set the nofile option meaning maximum number of open files.If you want to change the number of files of user, you should add this line in the limits.conf:

user  soft  nofile 9000

user  hard  nofile 65000

If  you want to set the nofile only for superuser you just write root instead of user.

root soft  nofile 9000

root hard  nofile 65000

Second you have to add a line in the /etc/pam.d/common-session file:

$ sudo gedit /etc/pam.d/common-session #open the file in gedit

Then add the line:

session required pam_limits.so

Now after rebooting you can see in the terminal with ulimit -a the change.

The option with wildcard *didn’t work for me , because I used root accout to run my programms and wildcard option doesn’t affect the superuser.

Remark: Using the same steps you should be able to set and change other parameters ( core file size, max user processes, stack size ….) from the ulimit options.

References:

  • Open File Limits Settings on Ubuntu
  • ulimits not set according to /etc/security/limits.conf for root – update documentation
  • Hacking Ubuntu to Improve Performance

Be Sociable, Share!
  • spacer
spacer
  • Tweet

[Translate]
This entry was posted in DBT2, Ubuntu and tagged DBT2, Ubuntu. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

5 Trackbacks

  1. By set maximum number on March 29, 2010 at 4:16 am

    [...] a maximum Number of items in Cart? – osCommerce …How do I set a maximum Number of items in Cart?Set ulimit parameters on ubuntuThe # means that this part is commented.The wildcard * means for all users.We need to set the nofile [...]

  2. By MongoDB “Too Many Open Files”? Raise the limit « Andrew Rollins on October 21, 2010 at 1:39 am

    [...] This blog post suggests that you can set system wide limits by editing /etc/security/limits.conf and /etc/pam.d/common-session, however, this only applies interactive and non-interactive shells (and processes started by them). When using just this technique, it didn’t appear to affect the open file limit of the mongodb process started by the default upstart script (without my added ulimit statement). [...]

  3. By ehcache.net on March 19, 2011 at 2:40 am

    Set ulimit parameters on ubuntu…

    By default the number of open files pro user in Ubuntu 8.04 is 1024. In my case this number was too small so I have to increase it.This is done with the ulimit command: $ulimit -a # see all the kernel parameters $ulimit -n #see the number of open files…

  4. By ulimit values not being remembered (Ubuntu 11.10) - The UNIX and Linux Forums on February 15, 2012 at 2:18 am

    [...] of open files on Ubuntu 11.10 (it's an Amazon EC2 instance) I followed the proccess outlined on this site, by editing /etc/security/limits.conf and adding [...]

  5. By setting memlock with limits.conf on March 11, 2012 at 10:00 pm

    [...] didn't help. Instead I used this guide: posidev.com/blog/2009/06/04/s…ers-on-ubuntu/ I edited: [...]

Post a Comment Cancel reply

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a class="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • isisun photos

  • You have 0 posts in pdf

  • Categories

  • spacer

    spacer

  • Charts

    spacer spacer
  • Reading

  • Recent Posts

    • What is Database Performance?
    • Weekly Highlights #47-48
    • Weekly Highlights #44-46
    • Weekly Highlights #43
    • Install MariaDB on Ubuntu 10.04 “Lucid Lynx”
  • Blogroll

    • .NET Rocks!
    • CodeProject
    • Drizzle
    • Greentech-bg
    • MySQL University
    • MySqlPerformanceBlog
    • SE-Radio
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.