(EXT) Linux performance and Tuning Guide 3.3 memory bottlenecks

Source: Internet
Author: User

Translation: Hank (http://blog.csdn.net/fireroll)
All rights reserved, respect other people's labor results, please indicate the author and original source and this statement when reproduced.
The original name: "Linux Performance and Tuning guidelines"
Original address: http://www.redbooks.ibm.com/abstracts/redp4285.html

3.3 Memory Bottlenecks
On a Linux system, many programs run at the same time.
These programs support multiple users, and some processes is more used than others.
Some of these programs use a portion of memory while the rest is "sleeping."
When a application accesses cache, the performance increases because an in-memory access retrieves data,
thereby eliminating the need to access slower disks.
In a Linux system, multiple programs that support multiple users at the same time are running, and they have less memory usage;
The program should access the memory data more efficiently than the disk;


The OS uses an algorithm to control which programs would use physical memory and which is 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 is not currently in use. Typically, page sizes is 4 KB or 8 KB.
In Linux, the page size was 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.
The operating system uses certain policies to determine which programs will use physical memory and which programs will be replaced from memory pages;
These operations are transparent to the user program;
Page space is a file created by the operating system on disk partition, used to store user programs that are not currently in use;
Typically, the page size is 4KB or 8KB;
In a Linux system, the page size is determined by the kernel's header file:
Include/asm-<architecture>/param.h
In the macro exec_pagesize to define;
The page that the process uses is replaced with a disk called a page break or a page overflow;


3.3.1 Finding Memory Bottlenecks
Looking for memory bottlenecks
This part of the article uses KDE's one of the tools KDE System guard to do memory detection;

Kde,k Desktop Environment (Kool. Environment).
A well-known operating system that runs on Linux, Unix, and FreeBSD, with a free graphical working environment,
The entire system is based on the QT library (now owned by Digia Company) developed by Trolltech Company.
Both KDE and Gnome are the most popular desktop environment systems on Linux operating systems.

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

?
Figure 3.1 KDE System guard Memory Monitoring

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

Table 3-1

Paging and swapping indicators
The meaning of page breaks and exchanges
In Linux, as with all unix-based operating systems, there is differences between paging and swapping.
Paging moves individual pages to swap space on the disk;
Swapping is a bigger operation this moves the entire address space of a process to swap space in one operation.
In Linux systems, distribution and switching are different;
Paging is the swap space for moving separate pages to disk;
Swapping is a larger operation, which moves the entire process's address space one time to the swap space of the disk;


Swapping can has one of the causes:
There are two causes of the exchange
. A process enters sleep mode.
Process enters sleep mode
This usually happens because the process depends on interactive action and editors, shells,
and data entry applications spend most of the their time waiting for user input. During this time,
They is inactive.
This usually happens because the process needs to interact with the editor, the shell, and the application needs to wait for the user's data input;
In this is, it is inactive;


. A process behaves poorly.
Abnormal behavior of the process
Paging can be a serious performance problem then the amount of free memory pages falls
Below the minimum amount specified, because the paging mechanism is isn't able to handle
The requests for physical memory pages and the swap mechanism are called to free more pages.
This significantly increases I/O to disk and would quickly degrade a server ' s performance.
When the free memory page is too small, a page break can cause serious performance problems.
Because the paging mechanism cannot handle requests for physical memory pages, the swap mechanism will invoke more free memory pages.
This drastically increases the I/O to the disk and quickly pulls down the performance of the server

If Your server is always paging to disk (A-page-out rate), consider adding more memory.
However, for systems with a low page-out rate, it might not affect performance.
If the server is always changing pages (a very high page change rate), you need to consider increasing the memory;
Of course, when the system page rate is low, it will not affect performance;

3.3.2 Performance Tuning Options
Performance Tuning Options
It believe there is a memory bottleneck,
Consider performing one or more of these actions:
If you identify a memory bottleneck, consider the following solution
. Tune the swap space using Bigpages, hugetlb, shared memory.
Adjust swap space, use large pages, chunk memory, share memory

. Increase or decrease the size of pages.
Increase or decrease the size of the page;
?
. Improve the handling of active and inactive memory.
Improved handling of active and inactive memory;

. Adjust the page-out rate.
Adjust the page change rate;
?
. Limit the resources used for each user on the server.
Restrict the resources available to each user on the server;

. Stop the services that is not a needed, as discussed in "Daemons" on page 97.
Stop the services you don't need

. ADD memory.
Increase memory

(EXT) Linux performance and Tuning Guide 3.3 memory bottlenecks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.