Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
5.4. Capacity Tuning
Read this section for an outline of memory, kernel and file system capacity, the parameters related to each, and the trade-offs involved in adjusting these parameters.
To set these values temporarily during tuning, echo the desired value to the appropriate file in the proc file system. For example, to set
overcommit_memory
temporarily to 1
, run:
# echo 1 > /proc/sys/vm/overcommit_memory
Note that the path to the parameter in the proc file system varies depending on the system affected by the change.
To set these values persistently, use the
sysctl
command. For information on how to use sysctl
, see E.4. Using the sysctl Command in the Red Hat Enterprise Linux 6 Deployment Guide.
Starting with Red Hat Enterprise Linux 6.6, the
/proc/meminfo
file provides the MemAvailable
field. To determine how much memory is available, run:
# cat /proc/meminfo | grep MemAvailable
Capacity-related Memory Tunables
Each of the following parameters is located under
/proc/sys/vm/
in the proc file system.
overcommit_memory
- 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 inovercommit_ratio
. This setting is best if you want a lesser risk of memory overcommitment.Note
This setting is only recommended for systems with swap areas larger than their physical memory.
overcommit_ratio
- Specifies the percentage of physical RAM considered when
overcommit_memory
is set to2
. The default value is50
. max_map_count
- Defines the maximum number of memory map areas that a process may use. In most cases, the default value of
65530
is appropriate. Increase this value if your application needs to map more than this number of files. nr_hugepages
- 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
Default values for the following parameters, located in the
/proc/sys/kernel/
directory, can be calculated by the kernel at boot time depending on available system resources.
To determine the page size, enter:
# getconf PAGE_SIZE
To determine the huge page size, enter:
# grep Hugepagesize /proc/meminfo
msgmax
- 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 currentmsgmax
value on your system, enter:# sysctl kernel.msgmax
msgmnb
- Defines the maximum size in bytes of a single message queue. To determine the current
msgmnb
value on your system, enter:# sysctl kernel.msgmnb
msgmni
- Defines the maximum number of message queue identifiers (and therefore the maximum number of queues). To determine the current
msgmni
value on your system, enter:# sysctl kernel.msgmni
- sem
- 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.
shmall
- 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
shmmax
divided by the hugepage size. However, Red Hat recommends checking your vendor documentation for recommended values. To determine the currentshmall
value on your system, enter:sysctl kernel.shmall
shmmax
- 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
shmmax
value on your system, enter:# sysctl kernel.shmmax
shmmni
- Defines the system-wide maximum number of shared memory segments. The default value is
4096
on all systems. threads-max
- Defines the system-wide maximum number of threads (tasks) to be used by the kernel at one time. To determine the current
threads-max
value on your system, enter:# sysctl kernel.threads-max
The default value is the result of:mempages / (8 * THREAD_SIZE / PAGE_SIZE )
The minimum value ofthreads-max
is20
.
Capacity-related File System Tunables
Each of the following parameters is located under
/proc/sys/fs/
in the proc file system.
aio-max-nr
- 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. file-max
- Lists the maximum number of file handles that the kernel allocates. The default value matches the value of
files_stat.max_files
in the kernel, which is set to the largest value out of either(mempages * (PAGE_SIZE / 1024)) / 10
, orNR_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
Out of Memory (OOM) refers to a computing state where all available memory, including swap space, has been allocated. By default, this situation causes the system to panic and stop functioning as expected. However, setting the
/proc/sys/vm/panic_on_oom
parameter to 0
instructs the kernel to call the oom_killer
function when OOM occurs. Usually, oom_killer
can kill rogue processes and the system survives.
The following parameter can be set on a per-process basis, giving you increased control over which processes are killed by the
oom_killer
function. It is located under /proc/pid/
in the proc file system, where pid is the process ID number.
oom_adj
- Defines a value from
-16
to15
that helps determine theoom_score
of a process. The higher theoom_score
value, the more likely the process will be killed by theoom_killer
. Setting aoom_adj
value of-17
disables theoom_killer
for that process.Important
Any processes spawned by an adjusted process will inherit that process'soom_score
. For example, if ansshd
process is protected from theoom_killer
function, all processes initiated by that SSH session will also be protected. This can affect theoom_killer
function's ability to salvage the system if OOM occurs.