Solaris Performance Monitoring of Swap space management
With the launching of e-commerce in full swing, the performance of Web servers has become particularly important. Once the server's capacity can not meet the needs of users, the service will be reduced to the user, then the need to upgrade server capacity. However, sometimes only for server performance tuning appropriate, will be able to cross the performance bottleneck, greatly increased the throughput capacity of the server, thereby reducing the cost of upgrading the server.
This article describes the solaris platform Swap (exchange) of the basic concepts of space, as well as the realization of the principle of Swap (exchange) of space to monitor the methods and strategy adjustment.
What is SWAP (exchange) of space
For the average system administrator for Solaris and rarely come into contact with Swap (exchange) of space in their area just seems to Swap disk partition, or several 12 Swap (exchange) file, when the system does not enough physical memory to deal with the current process, on the use of Swap (exchange) of virtual memory space as temporary storage space, this is from a technical point of view is not wrong, but when Swap in the realization of Solaris has its very unique place.
The role of SWAP space
As we all know, modern operating systems have achieved a "virtual memory" of this technology is not only a breakthrough in the functional limitations of the physical memory, so that can be manipulated more than the actual physical memory space and, more importantly, a "virtual memory" is the isolation of each In the process of safety net, so that each process of the interference from other programs.
The role of Swap space can be simply described as: the physical memory when the system enough time, it needs to be part of the physical memory space released for the use of currently running process. Space for those who have been released a long time may have come from any number of operating procedures, which were released space was temporarily saved to the Swap space, wait until those procedures should be run-time, and then to recover from Swap data saved to memory. In this way, the system is always in physical memory not only for exchange Swap. Computer users for this phenomenon is often encountered.
It should be a statement that not all from out of physical memory in the data exchange will be put in Swap (If this is the case, Swap will be overwhelmed), a considerable portion of the direct exchange of data to the file system. For example, some procedures would open some documents on the file to read and write (in fact, each of the programs are at least open a file that is running the program itself), when these processes need to exchange out of memory space, the document is not part of the data Swap space is necessary to put, if a document is read operation, then the memory directly on the release of data, no exchange, because the next time when necessary, directly from the file system will be able to resume; if it is to write documents, only need to change Save the data to a file in order to restore. But those who use malloc (3C) and the new function of the data generated by the object is different, the needs of Swap space, because they are not in the file system in the "reserve" files, so-called "Anonymous" (Anonymous) memory data, Such data also includes some of the state of the stack and variable data, so that, Swap space is the "anonymous" data exchange space.
Swap the configuration of the performance of
Swap space too much disk space will be wasted, and too little of Swap space, the system will be an error.
If the system ran out of physical memory, your system will, but can still run; if Swap space used up, then the system will be an error. For example, Web server requests based on the number of services derived from a number of processes (or threads), if the Swap space used up, the service process can not precession, there usually appear the "application is out of memory" errors, serious service process can cause deadlock. Swap space is therefore the distribution is very important.
Under normal circumstances, Swap space should be greater than or equal to the size of physical memory, the smallest not less than 64M, usually the size of Swap space should be 2-2.5 times the physical memory (Solaris 2 version of the above changes, see below) . However, according to different applications, different configurations should be: If it is a small desktop system, only smaller Swap space, and large server systems are different, as the case may require different size of Swap space. In particular, database server and Web server will be increased with the visit of Swap space requirements will increase, the specific configuration of their servers, see the product descriptions.
In addition, Swap the number of district performance are greatly affected. Swap exchange operation because it is the disk I / O operation, if there are multiple Swap swap, Swap space will be allocated by way of rotation of the operation to all Swap, it will greatly balanced I / O load, speed up the exchange Swap speed. If there is only one exchange area to exchange all of the swap operation will become very busy, the system is located in wait state most of the time, inefficient use of performance monitoring tools will be found that the CPU is not busy at this time, and system is slow, it shows that the bottleneck in the I / O on, rely on to increase the speed of CPU is not solve the problem.
Swap space allocation is very important, and the system in the run-time performance monitoring is a more valuable tool for performance monitoring through the system can check the performance index, find the bottleneck of system performance. In this paper, only brief and in the Solaris under the relevant Swap and use some order.
Is the most commonly used commands Vmstat, in most Unix platforms have this command, this command can see the majority of performance indicators.
In addition the use of swap-s can be a simple swap of the view the current use of resources. For example:
total: 65896k bytes allocated + 56840k reserved = 122736k used, 1069456k available
The ability to easily see that the swap space has been used and the size of the unused resources. Swap should be maintained below 30% of the load in order to guarantee the good performance of the system.
Swap of the characteristics of Solaris
Virtual Swap space
Swap space is to have virtual memory services, the Swap now Solaris has also become a virtual space, which is how in the end the case?
Let us look at an example to understand, when Solaris 2 in the previous version of Solaris (or other Unix, such as Linux) on the regular programming, a problem will emerge:
At present there is the assumption that the system memory space available for the 30M, and only 10M of Swap space, and then, if there is a process and an attempt to start the implementation of Malloc (15 * 1024 * 1024) of the order (15M space allocation), this process will fail because the command.
Why? System can be used instead of 30M of memory space? The reason is: Swap your space, the system that your future in the allocation of space, there is no capacity (space) page in the event of exchange, this part of the data is saved, so that you are not eligible for the allocation of this space. This is not unfair to the bar! Perhaps this exchange does not have 15M of space, the current system but also the surplus memory space 30M ah!
There are even more unfairly? Some large-scale system is equipped with a mass of memory, 1G or 4G, with a lot of memory is to avoid any exchange, increase the speed, but the system also for the distribution of the system does not require the Swap space occupied by a large number of disk resources.
In order to compensate for this defect, Sun for Solaris 2 version of the design of future virtual Swap space. Swap the so-called virtual space, the concept is very simple, swap space can not simply referring to the hard disk partition or file. Virtual Swap space consists of two parts: part of physical memory and traditions of the Swap partition. After proper configuration, you can make the system Swap space needs, the first part of the swap the use of memory space, if the memory part of the swap space is not enough to use part of the Swap disk space. In this way, maybe you Swap space on your hard disk to be used rarely, and even did not need a Swap partition.
Swap space and the relationship between file system TMPFS
Did you know? Virtual Swap space and / tmp directory has a significant relationship. Sun in the realization of / tmp directory, and fully taking into account the efficiency of the application is running. Many applications, especially database service will be frequently used / tmp directory as a temporary data storage area, and Solaris will be / tmp directory on the memory of documents rather than hard disk, it will greatly improve the efficiency of applications.
But the / tmp directory from the system space is squeezed out of virtual space is part of Virtual Swap space.，/tmp，Swap，/tmp，，!：
1. Mount / tmp directory, use the (-o Size) option to control the / tmp directory size.
2. When using the compiler to compile a document, if you do not want occupation of Swap space, the TMPDIR environment variable to use another temporary directory rather than / tmp directory.
Swap space on the operating system commands
Increase Swap space
1. To become super-user $ su - root
2. Create Swap file # mkfile nnn [klblm] filename
Such as: # mkfile 100m swapfile1
3. Activator Swap file Swap file must specify an absolute path, filename refers to the files created on the step.
4. Now the new role of the Swap file already, but after the system restarts, and will not remember a few steps before the operation. So in / etc / vfstab file log file name, and Swap types, such as:
/ path / filename - - Swap - no --
5. Efficacy with Swap file / usr / sbin / swap-l
Swap space to remove excess
1. To become super-user
2. The use of swap-d command to recover the swap space.
# / Usr / sbin / swap-d / path / filename
3. Edit / etc / ufstab files, removed the Swap (exchange) of the entity document.
4. From the file system to recover the file.
# Rm swap-filename
5. Of course, if the Swap (exchange) is not a document space, but a district, it would take to create a new file system, and then attached to the original file system.
- Sun's Solaris will be postponed to the open source Xen-based virtualization architecture
- 64-bit operating system Comments-Windows, Linux, FreeBSD, Solaris
- Solaris server configuration Multi-NIC
- Sun Solaris hard drives of different specifications so Disksuite mirror with the realization of
- Solaris 8 network print sharing services W2K
- Sun Solaris installation package to install the realization of the anti -
- SUN Solaris on the RTL8139 network card installed
- SUN Solaris Shell and the Shell Script Introduction
- SUN Solaris pipeline (pipe) and the input and output redirection (redirection)
- SUN Solaris terminal keys used to control
- SUN Solaris other orders
- SUN Solaris process (Process) control
- SUN Solaris system commands
- SUN Solaris communications command
- Sun Solaris format command
- Sun Solaris data backup and transfer tool
- SUN Solaris user management 2
- Solaris operating system pre-installed
- qmail in Linux, Solaris system installation Detailed
- How to make your Solaris in order to LS Color
Can't Find What You're Looking For?
Rating: Not yet rated