5.4. Capacity Tuning
# echo 1 > /proc/sys/vm/overcommit_memory
sysctlcommand. For information on how to use
sysctl, see E.4. Using the sysctl Command in the Red Hat Enterprise Linux 6 Deployment Guide.
/proc/meminfofile provides the
MemAvailablefield. To determine how much memory is available, run:
# cat /proc/meminfo | grep MemAvailable
Capacity-related Memory Tunables
/proc/sys/vm/in the proc file system.
- Defines the conditions that determine whether a large memory request is accepted or denied. There are three possible values for this parameter:
0— The default setting. The kernel performs heuristic memory overcommit handling by estimating the amount of memory available and failing requests that are blatantly invalid. Unfortunately, since memory is allocated using a heuristic rather than a precise algorithm, this setting can sometimes allow available memory on the system to be overloaded.
1— The kernel performs no memory overcommit handling. Under this setting, the potential for memory overload is increased, but so is performance for memory-intensive tasks.
2— The kernel denies requests for memory equal to or larger than the sum of total available swap and the percentage of physical RAM specified in
overcommit_ratio. This setting is best if you want a lesser risk of memory overcommitment.
NoteThis setting is only recommended for systems with swap areas larger than their physical memory.
- Specifies the percentage of physical RAM considered when
overcommit_memoryis set to
2. The default value is
- Defines the maximum number of memory map areas that a process may use. In most cases, the default value of
65530is appropriate. Increase this value if your application needs to map more than this number of files.
- Defines the number of hugepages configured in the kernel. The default value is 0. It is only possible to allocate (or deallocate) hugepages if there are sufficient physically contiguous free pages in the system. Pages reserved by this parameter cannot be used for other purposes. Further information is available from the installed documentation:
/usr/share/doc/kernel-doc-kernel_version/Documentation/vm/hugetlbpage.txt.For an Oracle database workload, Red Hat recommends configuring a number of hugepages equivalent to slightly more than the total size of the system global area of all databases running on the system. 5 additional hugepages per database instance is sufficient.
Capacity-related Kernel Tunables
/proc/sys/kernel/directory, can be calculated by the kernel at boot time depending on available system resources.
# getconf PAGE_SIZE
# grep Hugepagesize /proc/meminfo
- Defines the maximum allowable size in bytes of any single message in a message queue. This value must not exceed the size of the queue (
msgmnb). To determine the current
msgmaxvalue on your system, enter:
# sysctl kernel.msgmax
- Defines the maximum size in bytes of a single message queue. To determine the current
msgmnbvalue on your system, enter:
# sysctl kernel.msgmnb
- Defines the maximum number of message queue identifiers (and therefore the maximum number of queues). To determine the current
msgmnivalue on your system, enter:
# sysctl kernel.msgmni
- Semaphores, counters that help synchronize processes and threads, are generally configured to assist with database workloads. Recommended values vary between databases. See your database documentation for details about semaphore values.This parameter takes four values, separated by spaces, that represent SEMMSL, SEMMNS, SEMOPM, and SEMMNI respectively.
- Defines the total number of shared memory pages that can be used on the system at one time. For database workloads, Red Hat recommends that this value is set to the result of
shmmaxdivided by the hugepage size. However, Red Hat recommends checking your vendor documentation for recommended values. To determine the current
shmallvalue on your system, enter:
- Defines the maximum shared memory segment allowed by the kernel, in bytes. For database workloads, Red Hat recommends a value no larger than 75% of the total memory on the system. However, Red Hat recommends checking your vendor documentation for recommended values. To determine the current
shmmaxvalue on your system, enter:
# sysctl kernel.shmmax
- Defines the system-wide maximum number of shared memory segments. The default value is
4096on all systems.
- Defines the system-wide maximum number of threads (tasks) to be used by the kernel at one time. To determine the current
threads-maxvalue on your system, enter:
# sysctl kernel.threads-maxThe default value is the result of:
mempages / (8 * THREAD_SIZE / PAGE_SIZE )The minimum value of
Capacity-related File System Tunables
/proc/sys/fs/in the proc file system.
- Defines the maximum allowed number of events in all active asynchronous I/O contexts. The default value is
65536. Note that changing this value does not pre-allocate or resize any kernel data structures.
- Lists the maximum number of file handles that the kernel allocates. The default value matches the value of
files_stat.max_filesin the kernel, which is set to the largest value out of either
(mempages * (PAGE_SIZE / 1024)) / 10, or
NR_FILE(8192 in Red Hat Enterprise Linux). Raising this value can resolve errors caused by a lack of available file handles.
Out-of-Memory Kill Tunables
0instructs the kernel to call the
oom_killerfunction when OOM occurs. Usually,
oom_killercan kill rogue processes and the system survives.
oom_killerfunction. It is located under
/proc/pid/in the proc file system, where pid is the process ID number.
- Defines a value from
15that helps determine the
oom_scoreof a process. The higher the
oom_scorevalue, the more likely the process will be killed by the
oom_killer. Setting a
oom_killerfor that process.
ImportantAny processes spawned by an adjusted process will inherit that process's
oom_score. For example, if an
sshdprocess is protected from the
oom_killerfunction, all processes initiated by that SSH session will also be protected. This can affect the
oom_killerfunction's ability to salvage the system if OOM occurs.