转载自http://www.dbasquare.com/kb/how-to-adjust-oom-score-for-a-process/

How to adjust OOM score for a process?

Each process in Linux has a OOM score assigned to it. Its value is primarily based on the amount of memory a process uses. Whenever system is about to run out of memory, OOM killer terminates the program with the highest score.

To prevent it from killing a critical application, such as for example a database instance, the score can be manually adjusted. It is possible through /proc/[pid]/oom_score_adj (or /proc/[pid]/oom_adj for kernels older than 2.6.29). The range of values which oom_score_adj accepts is from -1000 to 1000, or from -17 to 15 in the deprecated interface that relies onoom_adj. The score is either reduced or increased by the adjustment value.

For example to reduce chances of loosing mysqld process:

  1. # ps ax | grep '[m]ysqld'
  2. 6445 ? Ssl 0:04 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf
  3. # cat /proc/6445/oom_score
  4. 124
  5. # echo '-1000' > /proc/6445/oom_score_adj
  6. # cat /proc/6445/oom_score
  7. 0
 

How to adjust OOM score for a process?的更多相关文章

  1. Running OOM killer script for process 32248 for Solr on port 8983

    Running OOM killer script for process 32248 for Solr on port 8983 分析1 https://blog.csdn.net/qq_41665 ...

  2. 【8.0.0_r4】AMS分析(十六)(ActivityManagerService.java上)

    代码位于frameworks/base/services/core/java/com/android/server/am/,一共有七十个文件. Java源码位于package com.android. ...

  3. Android 开机Process xxx (pid xxxx) has died问题分析

    系统中有一个监听BOOT_COMPLETED广播的自启应用,概率性出现启动后被kill掉的现象.Log如下: - :: I ActivityManager: Process com.test.xxx ...

  4. [Android Memory] Linux下malloc函数和OOM Killer

    http://www.linuxidc.com/Linux/2010-09/28364.htm Linux下malloc函数主要用来在用户空间从heap申请内存,申请成功返回指向所分配内存的指针,申请 ...

  5. 【chromium】 Chromium OS的oom机制

    前一段时间,运行在Chromium OS上的一个相机应用经常会自己崩溃,进程戛然而止,测试过程中发现使用的内存以肉眼可见的内存增长,当增长到1G左右,应用窗口突然消失,虽然原因不明,但是能猜到个大概, ...

  6. 进程物理内存远大于Xmx的问题分析

    问题描述 最近经常被问到一个问题,”为什么我们系统进程占用的物理内存(Res/Rss)会远远大于设置的Xmx值”,比如Xmx设置1.7G,但是top看到的Res的值却达到了3.0G,随着进程的运行,R ...

  7. stuff in /proc/PID/

    Table of Contents 1. /proc/PID/cwd 2. /proc/PID/clear_refs 3. /proc/PID/coredump_filter 4. /proc/PID ...

  8. upstart man

    man upstart nit(8) init(8) NAME init - Upstart process management daemon SYNOPSIS init [OPTION]... D ...

  9. Gerrit和OpenLDAP服务器集成

    Gerrit和OpenLDAP服务器集成 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.安装LDAP服务器 详情请参考:https://www.cnblogs.com/yinz ...

随机推荐

  1. 修改linux 文件权限命令 chmod

    [转载自:http://www.cnblogs.com/avril/archive/2010/03/23/1692809.html] Linux系统中的每个文件和目录都有访问许可权限,用它来确定谁可以 ...

  2. How to Run a .Jar Java File

    .jar files are used for archiving, archive unpacking. One of the essential features of jar file is l ...

  3. MySQL为数据表的指定字段插入数据

    username not null 没有默认值/有默认值   insert不插入username字段 均不报错 2014年07月23日21:05    百科369 MySQL为数据表的指定字段插入数据 ...

  4. Js练习题之查找字符串中出现最多的字符和个数

    如sssfgtdfssddfsssfssss,出现最多的字符是s,出现了12次 传统写法 分析: 1.准备一个空的json,通过循环字符串的每个字符来看,如果json里没有这个字符,就在json里创建 ...

  5. S1:动态方法调用:call & apply

    js中函数执行的两种方式:一是通过调用运算符’()’,二是通过调用call或apply来动态执行. 一.动态方法调用中指定this对象 开发中我们往往需要在对象B中调用对象A的方法,这个时候就用到了a ...

  6. bzoj 2242: [SDOI2011]计算器

    #include<cstdio> #include<iostream> #include<map> #include<cmath> #define ll ...

  7. php解密java的DES加密

    echo openssl_decrypt( $密文 ,"des-ecb" , $密钥 );

  8. ubuntu 14.04 难用的vi

    在插入状态下,按方向键出来的结果竟然是大写的字母ABCD,这是因为在ubuntu中其实没装vi,只装了vim-tiny,在系统上,vi仅仅是vim的一个别名. 这时候需要自己安装完整版的 vim su ...

  9. iOS解决两个静态库的冲突 duplicate symbol

    http://blog.163.com/023_dns/blog/static/118727366201391544630380/ 场景: 解决TencentOpenAPI.framework与Zba ...

  10. MYSQL数据库导入导出(可以跨平台)

    MYSQL数据库导入导出.sql文件 转载地址:http://www.cnblogs.com/cnkenny/archive/2009/04/22/1441297.html 本人总结:直接复制数据库, ...