翻译:Hank (http://blog.csdn.net/fireroll)
版权所有,尊重他人劳动成果,转载时请注明作者和原始出处及本声明。
原文名称:《Linux Performance and Tuning Guidelines》
原文地址:http://www.redbooks.ibm.com/abstracts/redp4285.html

3.3 内存瓶颈
On a Linux system, many programs run at the same time. 
These programs support multiple users, and some processes are more used than others. 
Some of these programs use a portion of memory while the rest are “sleeping.” 
When an application accesses cache, the performance increases because an in-memory access retrieves data, 
thereby eliminating the need to access slower disks.
在linux系统中,在同一时间有支持多个用户的多个程序在运行,它们对内存使用有多有少;
应该程序访问内存数据的效率要比磁盘高;

The OS uses an algorithm to control which programs will use physical memory and which are paged out. 
This is transparent to user programs. Page space is a file created by the OS on a disk partition 
to store user programs that are not currently in use. Typically, page sizes are 4 KB or 8 KB. 
In Linux, the page size is defined by using the variable EXEC_PAGESIZE in the include/asm-<architecture>/param.h 
kernel header file. The process used to page a process out to disk is called pageout.
操作系统使用一定的策略来决定哪些程序将使用物理内存,哪些程序将被从内存页面中替出;
这些操作对用户程序来说是透明的;
页面空间是由操作系统在磁盘划分上创建的文件,用来存储当前未在使用的用户程序;
通常,页面大小为 4KB 或 8KB; 
在Linux系统中,页面大小由内核的头文件:
include/asm-<architecture>/param.h 
中的宏 EXEC_PAGESIZE 来定义;
进程使用的页面被替换到磁盘称为换页 或 页面溢出;

3.3.1 Finding memory bottlenecks 
寻找内存瓶颈
文章的这部分使用了KDE的一个工具KDE System Guard来做内存检测;

KDE,K桌面环境(Kool Desktop Environment)的缩写。
一种著名的运行于 Linux、Unix 以及FreeBSD 等操作系统上面自由图形工作环境,
整个系统采用的都是 TrollTech 公司所开发的Qt程序库(现在属于Digia公司)。
KDE 和 Gnome 都是 Linux 操作系统上最流行的桌面环境系统。

Start your analysis by listing the applications that are running on the server. 
Determine how much physical memory and swap each application needs to run. 
Figure 3-1 on page 83 shows KDE System Guard monitoring memory usage.


图 3.1 KDE System Guard内存监测

​The indicators in Table 3-1 can also help you define a problem with memory.

表3-1

Paging and swapping indicators
换页和交换的意义
In Linux, as with all UNIX-based operating systems, there are differences between paging and swapping. 
Paging moves individual pages to swap space on the disk; 
swapping is a bigger operation that moves the entire address space of a process to swap space in one operation.
在Linux系统中,分布和交换是不同的;
换页是将独立的页面移到磁盘的交换空间;
交换是更大的操作,它将整个进程的地址空间一次性移到磁盘的交换空间;

Swapping can have one of two causes:
导致交换的原因有两个
. A process enters sleep mode. 
  进程进入 sleep 模式
  This usually happens because the process depends on interactive action and editors, shells, 
  and data entry applications spend most of their time waiting for user input. During this time, 
  they are inactive.
  这种情况通常是因为进程需要和编辑器,shell等交互,以及应用程序需要等待用户的数据输入;
  在这是,它是非活动的;

. A process behaves poorly. 
  进程的异常行为
  Paging can be a serious performance problem when the amount of free memory pages falls 
  below the minimum amount specified, because the paging mechanism is not able to handle 
  the requests for physical memory pages and the swap mechanism is called to free more pages. 
  This significantly increases I/O to disk and will quickly degrade a server’s performance.
  当空闲内存页面过小时,换页会导致严重的性能问题,
  因为换页机制不能处理物理内存页面的请求,而交换机制将会调用更多的空闲内存页面。
  这会急剧增加磁盘的I/O, 并快速地拉低服务器的性能

If your server is always paging to disk (a high page-out rate), consider adding more memory.
However, for systems with a low page-out rate, it might not affect performance.
如果服务器总是在换页(一个很高的换页率),就需要考虑增加内存;
当然,系统换页率低时,它不会影响性能;

3.3.2 Performance tuning options
性能调整选项
It you believe there is a memory bottleneck, 
consider performing one or more of these actions:
如果你确认是内存的瓶颈,可以考虑用下面的办法来解决
. Tune the swap space using bigpages, hugetlb, shared memory.
  调整交换空间,使用大页面,大块内存,共享内存

. Increase or decrease the size of pages.
  增加或降低页面的大小;

. Improve the handling of active and inactive memory.
  改进对活动和非活动内存的处理;

. Adjust the page-out rate.
  调整换页率;

. Limit the resources used for each user on the server.
  限制服务器上每个用户的可用资源;

. Stop the services that are not needed, as discussed in “Daemons” on page 97.
  停掉不需要的服务

. Add memory.
  增加内存

(转)《linux性能及调优指南》 3.3 内存瓶颈的更多相关文章

  1. 《Linux 性能及调优指南》写在后面的话

    感谢飞哥的翻译. 目前飞哥 (http://hi.baidu.com/imlidapeng)的网址已经不能访问了. <Linux 性能及调优指南>这本书的原文地址:http://www.r ...

  2. 《linux性能及调优指南》 3.5 网络瓶颈

    3.5 Network bottlenecks A performance problem in the network subsystem can be the cause of many prob ...

  3. 《Linux 性能及调优指南》2.3 监控工具

    翻译:飞哥 (http://hi.baidu.com/imlidapeng) 版权所有,尊重他人劳动成果,转载时请注明作者和原始出处及本声明. 原文名称:<Linux Performance a ...

  4. 《Linux 性能及调优指南》1.5 网络子系统

    翻译:飞哥 (http://hi.baidu.com/imlidapeng) 版权所有,尊重他人劳动成果,转载时请注明作者和原始出处及本声明. 原文名称:<Linux Performance a ...

  5. 《Linux性能及调优指南》1.3 Linux文件系统

    翻译:飞哥 (http://hi.baidu.com/imlidapeng) 版权所有,尊重他人劳动成果,转载时请注明作者和原始出处及本声明. 原文名称:<Linux Performance a ...

  6. 《Linux 性能及调优指南》1.4 硬盘I/O子系统

    翻译:飞哥 (http://hi.baidu.com/imlidapeng) 版权所有,尊重他人劳动成果,转载时请注明作者和原始出处及本声明. 原文名称:<Linux Performance a ...

  7. 《Linux 性能及调优指南》3.1 确认瓶颈

    翻译:飞哥 ( http://hi.baidu.com/imlidapeng ) 版权所有,尊重他人劳动成果,转载时请注明作者和原始出处及本声明. 原文名称:<Linux Performance ...

  8. Linux性能及调优指南1.2之Linux内存架构

    本文为IBM RedBook的Linux Performanceand Tuning Guidelines的1.2节的翻译原文地址:http://www.redbooks.ibm.com/redpap ...

  9. 《Linux 性能及调优指南》1.6 了解Linux性能指标

    翻译:飞哥 (http://hi.baidu.com/imlidapeng) 版权所有,尊重他人劳动成果,转载时请注明作者和原始出处及本声明. 原文名称:<Linux Performance a ...

  10. Linux性能及调优指南(翻译)之Linux进程管理

    本文为IBM RedBook的Linux Performanceand Tuning Guidelines的1.1节的翻译原文地址:http://www.redbooks.ibm.com/redpap ...

随机推荐

  1. 【面试必问】python实例方法、类方法@classmethod、静态方法@staticmethod和属性方法@property区别

    [面试必问]python实例方法.类方法@classmethod.静态方法@staticmethod和属性方法@property区别 1.#类方法@classmethod,只能访问类变量,不能访问实例 ...

  2. 牛客小白赛4J——强迫症

    链接:https://www.nowcoder.com/acm/contest/134/J 来源:牛客网 思路:把数列排序,把每一个重复的元素和最后一个数想加得到新数,在删掉这一元素即为去重的最少步骤 ...

  3. mysql 题目练习

    1 新建一个测试数据库: create database test1 charset utf8; 2 进入数据库 use test1; 3 新建一个sql 文件 ,将下面内容复制进sql 文件 /* ...

  4. SpringBoot学习:整合shiro(rememberMe记住我后自动登录session失效解决办法)

    项目下载地址:http://download.csdn.NET/detail/aqsunkai/9805821 定义一个拦截器,判断用户是通过记住我登录时,查询数据库后台自动登录,同时把用户放入ses ...

  5. 孤荷凌寒自学python第八十六天对selenium模块进行较详细的了解

    孤荷凌寒自学python第八十六天对selenium模块进行较详细的了解 (今天由于文中所阐述的原因没有进行屏幕录屏,见谅) 为了能够使用selenium模块进行真正的操作,今天主要大范围搜索资料进行 ...

  6. [Clr via C#读书笔记]Cp9参数

    Cp9参数 可选参数和命名参数 参数设置了默认值(设置要从右到左,有默认值的参数必须放在没有默认值的参数的后面,默认值必须是常量),就可以使用可选参数和命名参数了.向方法传递实参的时候,编译器按照从左 ...

  7. 【MFC】VS2017新建完MFC后,没有界面,只有代码

    问题描述:双击.rc文件后提示在另一个编辑器中打开 解决方法整合: 1----- 打开工程之前先把.rc文件改个名称,然后打开工程双击解决方案管理器的.rc文件, 会显示"载入失败" ...

  8. 开源自动驾驶仿真平台 AirSim (3) - 运行 AirSim

    AirSim 的官方 Github: https://github.com/Microsoft/AirSim 之前配置了很多,终于要让 AirSim 自己跑起来了. 我们需要把 AirSim 这个插件 ...

  9. LeetCode 240——搜索二维矩阵 II

    1. 题目 2. 解答 2.1. 方法一 从矩阵的左下角开始比较 目标值等于当前元素,返回 true: 目标值大于当前元素,j 增 1,向右查找,排除掉此列上边的数据(都比当前元素更小): 目标值小于 ...

  10. wamp下安装https 实现 ssl 协议,主要是编写小程序通讯

    也不知道腾讯为啥要这个限制,是想卖他的服务器资源么 简单几句话 1 wamp3.0.X的版本不行,我折腾了一天半,放弃了,换成wamp2.5 一次通过 2 证书 去腾讯云申请,单独域名的可以申请免费的 ...