How to Change ulimit parameters for user


*Don't forget to logout and login to verify your configuration applied. Also application restart should be a safe way.

Information:

#ulimit  -a

core file size          (blocks, -c) 0

data seg size           (kbytes, -d) unlimited

scheduling priority             (-e) 20

file size               (blocks, -f) unlimited

pending signals                 (-i) 16382

max locked memory       (kbytes, -l) 64

max memory size         (kbytes, -m) unlimited

open files                      (-n) 1024

pipe size            (512 bytes, -p) 8

POSIX message queues     (bytes, -q) 819200

real-time priority              (-r) 0

stack size              (kbytes, -s) 8192

cpu time               (seconds, -t) unlimited

max user processes              (-u) unlimited

virtual memory          (kbytes, -v) unlimited

file locks                      (-x) unlimited

Ulimit  options that are supported by every shell I've seen:

  • -H: Combine with other options to set or show the hard limit only.
  • -S: Combine with other options to set or show the soft limit only.
  • -c: maximum core file size (512-byte blocks)
  • -d: maximum heap (data segment) size (kB)
  • -f: maximum file size (512-byte blocks)
  • -n: maximum number of file descriptors
  • -s: maximum stack size (kB)
  • -t: maximum CPU time (s)

A few other very common options:

  • -a: Display all limits.
  • -m: maximum physical memory size (kB)
  • -v: maximum virtual memory size (kB)

OS Examples;

  • Redhat|config
# vi /etc/security/limits.conf

oracle     soft     nofile    65536

oracle     hard     nofile   65536[/shell]

Only  Edit  limits.conf  file  is enough  for  soft  and  hard  open files  limit  but in some case  you should  add this to profile.

ulimit –n 65536

Max. file  parameter can be  defined  with  this formula.

for  8GB ram capacity;

8gb= 8192 mb

8192/4= 2048

2048*256=524288

[shell]# sysctl -w fs.file-max= 524288[/shell]

and  permananet;

[shell]# cat /etc/sysctl.conf[/shell]

fs.file-max = 524288

[shell]# sysctl –p
  • Redhat|monitoring
#ulimit -a[
#ulimit -a -H   // hard limit.
  • Solaris|config
]#vi /etc/system

set rlim_fd_max = 4096   #hard

set rlim_fd_cur = 1024     #soft

For  oracle  database  maybe  you need to set project  to define limit. This  is a well-known method  to specify  limit  parameters  for  oracle  user.

# projadd -U oracle -K "process.max-file-descriptor=(priv,4096,deny)" user.oracle

# echo 'rlim_fd_max/D' | mdb -k

# echo 'rlim_fd_cur/D' | mdb -k
  • Solaris|monitoring
# ulimit -Ha //hard

# ulimit -Sa // soft

# ulimit -n / open files
  • HP-UX|config

For  HP-UX  ,also you need to check  and  verify  kernel  parameters. You need to use  kctune  to configure  kernel  parameter  which  belongs  to  your  limit  options.

#kctune -v maxfiles

#vi /home/user/.profile veya /etc/profile

ulimit -n 4096
  • HP-UX|monitoring
# ulimit -Ha //hard

# ulimit -Sa // soft

# ulimit -n / open files

 

Tagged In:

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me