Skip to content
Home » Linux » How to Refresh Web Servers Instead of Reboots on Enterprise Linux 6

How to Refresh Web Servers Instead of Reboots on Enterprise Linux 6

Some system administrators (SA) regularly reboots the web server for better performance, it's clean and totally refreshed. But for 24/7 services, server reboots will interrupt user connections for several minutes, or worse, the server might stuck in the process.

Therefore, we should avoid to reboot the server or reduce the number of times of reboot except planned shutdowns. But the question is, how to refresh the server to close to a newly startup one?

First of all, we should identify and know how to deal with the high-consuming services of memory in a web server.
  1. Restart httpd service.
  2. Restart mysqld service.
  3. Restart rsyslog service.
  4. Clear SWAP space.
Let's see the memory before refreshing.
[root@test ~]# free
             total       used       free     shared    buffers     cached
Mem:       2009040    1984816      24224          0       5136     349888
-/+ buffers/cache:    1629792     379248
Swap:      1048568      15032    1033536

Do the following actions:
[root@test ~]# service rsyslog restart; service httpd restart; service mysqld restart; swapoff -a; swapon -a
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

Let's see the memory after refreshing.
[root@test ~]# free
             total       used       free     shared    buffers     cached
Mem:       2009040     665392    1343648          0      12528     235104
-/+ buffers/cache:     417760    1591280
Swap:      1048568          0    1048568

This takes less than 5 seconds to complete. It's pretty fast.

Leave a Reply

Your email address will not be published. Required fields are marked *