Server version: Percona 5.5.18-log Source distribution
innodb设置:
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 8G
innodb_additional_mem_pool_size = 80M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 500M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 0
innodb_lock_wait_timeout = 50
#innodb_flush_method = O_DIRECT
the article you referred to is misleading...OOM actually has a heuristic algorithm based upon weight. So, the statement of "always kill the process that consumes most of memory" is not accurate:
The answer lies inside mm/oom_kill.c of the Linux source code. This C code represents the so-called OOM killer of the Linux kernel. The function badness() give a score to each existing processes. The one with highest score will be the victim. The criteria are:
#1, VM size. This is not the sum of all allocated pages, but the sum of the size of all VMAs owned by the process. The bigger the VM size, the higher the score.
#2, Related to #1, the VM size of the process's children are important too. The VM size is cumulative if a process has one or more children.
#3, Processes with task priorities smaller than zero (niced processes) get more points.
#4, Superuser processes are important, by assumption; thus they have their scores reduced.
#5, Process runtime. The longer it runs, the lower the score.
#6, Processes that perform direct hardware access are more immune.
#7, The swapper (pid 0) and init (pid 1) processes, as well as any kernel threads immune from the list of potential victims.
The process with the biggest score "wins" the election and the OOM killer will kill it very soon.
the article you referred to is misleading...OOM actually has a heuristic algorithm based upon weight. So, the statement of "always kill the process that consumes most of memory" is not accurate:
The answer lies inside mm/oom_kill.c of the Linux source code. This C code represents the so-called OOM killer of the Linux kernel. The function badness() give a score to each existing processes. The one with highest score will be the victim. The criteria are:
#1, VM size. This is not the sum of all allocated pages, but the sum of the size of all VMAs owned by the process. The bigger the VM size, the higher the score.
#2, Related to #1, the VM size of the process's children are important too. The VM size is cumulative if a process has one or more children.
#3, Processes with task priorities smaller than zero (niced processes) get more points.
#4, Superuser processes are important, by assumption; thus they have their scores reduced.
#5, Process runtime. The longer it runs, the lower the score.
#6, Processes that perform direct hardware access are more immune.
#7, The swapper (pid 0) and init (pid 1) processes, as well as any kernel threads immune from the list of potential victims.
The process with the biggest score "wins" the election and the OOM killer will kill it very soon.