Pages

Tuesday, January 29, 2013

Tunable Linux Kernel Parameters


Parameters that can be used in dealing with Shared memory Segments

localHost:Root-~ $ ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 67108864
max total shared memory (kbytes) = 17179869184
min seg size (bytes) = 1

SHMMAX is used to define the maximum size (in bytes) for a shared memory segment. the larger it is, the better Caché performance will be.

To get the Shmmax value we can use

localHost:Root-~ $ cat /proc/sys/kernel/shmmax
68719476736

We can change the value in /etc/sysctl.conf file.

SHMALL controls the total amount of shared memory (in pages) that can be used at one time on the system.

To find this we can use,

localHost:Root-~ $ cat /proc/sys/kernel/shmall
4294967296

SHMMNI : This kernel parameter is used to set the maximum number of shared memory segments system wide. The default value for this parameter is 4096. This value is sufficient and typically does not need to be changed.

localHost:Root-~ $ cat /proc/sys/kernel/shmmni
4096

Page Size: To get the page Size we can use

localHost:Root-~ $ getconf PAGESIZE
4096
If we make any Changes to the /etc/sysctl.conf file , we need to execute the ‘sysctl –p’ command for the changes to update.

Parameters that can be used in dealing with Semaphores

localHost:Root-~ $ ipcs -ls

------ Semaphore Limits --------
max number of arrays = 512
max semaphores per array = 512
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767


semmsl – This kernel parameter is used to control the maximum number of semaphores per semaphore set

semmni – This kernel parameter is used to control the maximum number of semaphore sets in the entire Linux system

semmns – This kernel parameter is used to control the maximum number of semaphores (not semaphore sets) in the entire Linux system

File Handles

When configuring the Linux server, it is critical to ensure that the maximum number of file handles is large enough. The setting for file handles denotes the number of open files that you can have on the Linux system

localHost:Root-~ $ cat /proc/sys/fs/file-max
6487024

Oracle recommends that the file handles for the entire system be set to at least:
512 * PROCESSES , where PROCESSES is the value specified for the instance(s) running on the server. I typically use a value no less than 65536.

Current usage of file handles can be obtained by using ,

localHost:Root-~ $ cat /proc/sys/fs/file-nr
7650 0 6487024

The file-nr file displays three parameters :
  • Total allocated file handles
  • Currently used file handles
  • Maximum file handles that can be allocated


IP Local Port Range

Oracle strongly recommends to set the local port range ip_local_port_range for outgoing messages to “1024 65000″ which is needed for systems with high-usage. This kernel parameter defines the local port range for TCP and UDP traffic to choose from. The default value for ip_local_port_range is ports 32768 through 61000.

localHost:Root-~ $ cat /proc/sys/net/ipv4/ip_local_port_range
32768 61000

The receive buffers are used by TCP and UDP to hold received data until it is read by the application. The receive buffer cannot overflow because the peer is not allowed to send data beyond the buffer size window. This means that datagrams will be discarded if they don’t fit in the socket receive buffer, potentially causing the sender to overwhelm the receiver.

cat /proc/sys/net/core/rmem_default
109568
cat /proc/sys/net/core/rmem_max
131071
cat /proc/sys/net/core/wmem_default
109568
cat /proc/sys/net/core/wmem_max
131071

Configuring Shell Limits for the oracle User

To improve the performance of the software on Linux systems, Oracle recommends you increase the following shell limits for the oracle user :

Shell Limit
Item in limits.conf
Hard Limit
Maximum number of open file descriptors
nofile
65536
Maximum number of processes available to a single user
nproc
16384

cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <<EOF
# Added for Oracle Shell Limits
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so
EOF

More To Come , Happy Learning.