一、相关概念简介

  • system call:系统调用
  • time slice:cpu时间片
  • O(1):Linux系统进程调度器
  • page frame:分页
  • RSS:常驻内存集,无法被页面化的数据
  • MMU:内存管理单元,维护线性地址空间和物理地址空间的映射表
  • TLB:转换后缓冲器
  • huge page:大页
  • NUMA:非一致内存访问,有多颗CPU,每颗CPU有自己的内存段,每段叫做一个node,建议进程做CPU亲缘性绑定

二、CPU内存调优

  • 调进程与CPU的亲缘性
# taskset -p mask pid
# taskset mask -- program
# taskset -c 0,,2-7 -- myprogram
# taskset -p -c 1 17947  #将pid为17947的进程绑定至第2颗CPU上,重启失效
  • 查看进程当前运行在哪颗CPU上
# ps axo psr,pid,cmd
  • cpu中断统计
# cat /proc/interrupts
  • numactl:对MUMA策略管理
  • 调整进程优先级:nice, renice
  • 隔离CPU,被隔离的CPU不会处理中断
# vim /etc/grub.conf
kernel ...... lsolcpus=1,2,3...
  • 调度类别:
SCHED_FIFO [0-99]
chrt -f [1-99] /path/to/program arguments
SCHED_RR
chrt -f [1-99] /path/to/program arguments
SCHED_NORMAL [100-139]
nice,renice
  • 0 - 139
1-99:实时优先级
100-139:动态优先级
  • 性能监控工具
htop
dstat
glances
sysdig
sar -P ALL 1 2
vmstat 1 5
iostat -c 1
  • 配置大页
vm.nr_hugepages = 10
  • 当前系统打开最大文件数
fs.file-max = 8192
  • 当前系统所以异步io允许的最大事件数
fs.aio-max-nr = 65535
  • OOM可调参数
vm.panic_on_oom = 0
/proc/pid/oom_adj [-16-15] #数字越高,被杀死的值越大,如果是-17则这个进程是无懈可击的

三、内存总结

nr_hugepages
swapiness
overcommit_memory

Linux调优(内存,CPU)的更多相关文章

  1. 于erlang依赖的linux调优

    [皇室]杭州-sunface(61087682) 上午 9:42:02 http://docs.basho.com/riak/latest/ops/tuning/linux/ 这篇文章对于erlang ...

  2. JVM 调优 内存调优 CPU 使用调优 锁竞争调优 I/O 调优

    Twitter 工程师谈 JVM 调优 2016年03月24日 10:22:30 wenniuwuren https://blog.csdn.net/wenniuwuren/article/detai ...

  3. (转)SQL Server 性能调优(cpu)

    摘自:http://www.cnblogs.com/Amaranthus/archive/2012/03/07/2383551.html 研究cpu压力工具 perfom SQL跟踪 性能视图 cpu ...

  4. sql server 性能调优之 CPU消耗最大资源分析1 (自sqlserver服务启动以后)

    一. 概述 上次在介绍性能调优中讲到了I/O的开销查看及维护,这次介绍CPU的开销及维护, 在调优方面是可以从多个维度去发现问题如I/O,CPU,  内存,锁等,不管从哪个维度去解决,都能达到调优的效 ...

  5. [转]SQL Server 性能调优(cpu)

      研究cpu压力工具 perfom SQL跟踪 性能视图 cpu相关的wait event Signal wait time SOS_SCHEDULER_YIELD等待 CXPACKET等待 CME ...

  6. LINUX调优

    一.Linux系统调优及安全设置 系统安装安全最小化原则说明 ◆安装linux系统最小化,即选包最小化,yum安装软件最小化. ◆开机自启动程序服务最小化,即无用的服务不开启. ◆操作命令最小化原则, ...

  7. linux查看占用内存/cpu最高的进程情况

    linux查看占用cpu最高的进程 ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head 或者top (然后按下M,注意这里是大写) linux查 ...

  8. 转 Linux调优方案,sysctl.conf的设置

    $ /proc/sys/net/core/wmem_max最大socket写buffer,可参考的优化值:873200 $ /proc/sys/net/core/rmem_max最大socket读bu ...

  9. Linux 调优方案, 修改最大连接数(ulimit命令)【转】

    转自:http://blog.csdn.net/liangxiaozhang/article/details/8363435 Linux对于每个用户,系统限制其最大进程数.为提高性能,可以根据设备资源 ...

随机推荐

  1. codeforces 710C C. Magic Odd Square(构造)

    题目链接: C. Magic Odd Square Find an n × n matrix with different numbers from 1 to n2, so the sum in ea ...

  2. codeforces 655A A. Amity Assessment(水题)

    题目链接: A. Amity Assessment time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  3. php实现多文件上传和下载。

    http://1229363.blog.163.com/blog/static/19743427200751291055264/

  4. Mybatis学习--日志

    学习笔记,选自Mybatis官方中文文档:http://www.mybatis.org/mybatis-3/zh/logging.html Logging Mybatis内置的日志工厂提供日志功能,具 ...

  5. Metaspoit的使用

    一.环境的使用和搭建 首先我的攻击机和靶机都搭建在虚拟机上,选用的是VMware Workstation Pro虚拟机. 攻击机选用的是Linux kali 2017.2版本,而靶机安装的是XP sp ...

  6. ACM学习历程—POJ3090 Visible Lattice Points(容斥原理 || 莫比乌斯)

    Description A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal ...

  7. bzoj 2732: [HNOI2012]射箭 半平面交

    题目大意: http://www.lydsy.com/JudgeOnline/problem.php?id=2732 题解: 这道题的做法我不想说什么了... 其他题解都有说做法... 即使是我上午做 ...

  8. Eclipse或MyEclipse中给第三方jar包添加源码步骤

    0.目的 向web项目中添加mybatis源码. 1.项目结构如下 将mybatis的jar包添加到工程中 2.解压下载的mybatis压缩包(下载地址 https://github.com/myba ...

  9. 如何得到DataTable的列名

    foreach (DataColumn dc in dtfood.Columns) { string lm = dc.ColumnName; }

  10. poj 1519 Digital Roots (计算根数字)

    一.Description The digital root of a positive integer is found by summing the digits of the integer. ...