Optimize centos servers in vps

Source: Internet
Author: User

VPS is a type of virtualization, but it only has an independent system, and the root virtual machine is quite different. this blog uses VPS as an example. Because the VPS system is selected by you, but how to install it is not controlled by you, you do not need to install it, and also occupies a lot of resources. in this article, I will talk about my method, which is applicable to various other servers.

Let's take a look at the memory of my VPS.

[root@localhost ~]# free -m             total       used       free     shared    buffers     cachedMem:           502        497          5          0          0         13-/+ buffers/cache:        483         19Swap:         2047       1023       1024[root@localhost ~]# top -b -i -n 1top - 16:31:24 up 62 days, 10 min,  1 user,  load average: 4.91, 5.56, 4.16Tasks: 186 total,   1 running, 185 sleeping,   0 stopped,   0 zombieCpu(s):  0.8%us,  0.2%sy,  0.1%ni, 87.5%id,  3.1%wa,  0.2%hi,  8.2%si,  0.0%stMem:    514812k total,   508512k used,     6300k free,      700k buffersSwap:  2097144k total,  1049588k used,  1047556k free,    18072k cached  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND  176 root      10  -5     0    0    0 D  1.7  0.0  84:33.84 kswapd025822 root      17   0 41668  22m 2092 D  1.7  4.4   2:21.32 php-cgi32244 root      15   0  2424  960  696 R  1.7  0.2   0:00.03 top


After reading it with top, the kswapd0 process appears. If it appears, it indicates that the system memory is insufficient. The system will wake up kswapd every time and check whether the memory is tight. If not, sleep. In kswapd, there are two thresholds: pages_hige and pages_low, when the number of idle memory pages is lower than pages_low, The kswapd process will scan the memory and release 32 free pages each time until the number of free pages reaches pages_high.

I have only one principle, that is, I don't need it. If the system resources are high and the operation of the system is not affected, KILL it all.

Step 1: run the top command to check the processes that occupy the system. Check whether it is useful to yourself.

Step 2: Check the chkconfig -- list. When the system is started, KILL the self-started process.

Step 3: Run ps-e to check whether there are useless or useless processes in the started mileage.

Processes that can be killed or not killed can be retained if the system resources are sufficient.

1. xorg, and the processes related to the running of the operating system.

Xorg is a desktop process. If I had to install the server system, I would never have installed it, which is too resource-consuming. There is also openoffice. Pkill: If no kill is killed, kill and process PID are added. If no kill is killed, kill-9 is used. If not. Perform the following operations:

[Root @ localhost ~] # Vim/etc/inittab id: 3: initdefault: # Find this line and change 5 to 3 without entering the desktop.


Then restart the system, so that the Xorg process will disappear, and the processes related to the running.

2. sendmail

Old tools for sending emails. Chkconfig sendmail off, boot off.

3, bluetooth

I did not expect this to happen. The process is KILL. If it is started on itself, it should be switched off as above.

4. syslog

System logs. If the system resources are sufficient, this process must be retained.

5, gam_server

I checked the changes to the files on the local disk online and said that this process would occupy 512 of CPU usage. Although not found in the TOP, for systems with only of memory, or KILL it first.

6. hald-addon-stor

It is responsible for detecting the insertion of peripheral devices. When I use the top command, this process accounts for 0.5% MEM of CPU and remains occupied and will not be released. KILL

7. nfs

One type of File server, NFS stands for Network File System (Network File System). It is useful, but I cannot use it, so I KILL it.

There are many processes in linux. When kill, you must know what the process is. Not all processes can be killed. You must check more processes on the Internet before killing them. After the killing process is completed, the computer is restarted. Memory saved.

Vps Optimization

The swap partition is not used, and there is 16 6 m of available memory.

Author: sea bottom e
Address: http://blog.51yip.com/server/1480.html

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.