modern-web-design-and-development

(Brent) #1

Quick Fix


The quickest solution is to kill the memory hog. You will need to be root to
do this (unless the process is owned by you — see below). First of all,
though, search on Google to find out what exactly you are about to kill. If
you kill a core program (such as the SSH server), you’ll be back to
telephone support. If you kill your biggest client’s data amalgamation
program, which has been running for four days and is just about to finish,
then the client could get annoyed, despite your effort to sweeten it with
“But your website is okay now!”


If the culprit is HTTPD or Apache or MySQLd, then skip to the next section,
because those can be restarted more gracefully. In fact, most things can be
restarted more gracefully, but this is a quick ignore-the-consequences type
of fix.


Find the process ID in the PID column of the command above, and type
kill -9, followed by the number. For example:


root@server# kill -9 23421

The -9 tells it to stop completely and absolutely. You can now run top
again to see whether it has made a difference. If some other similar process
has jumped to the memory-eating position instead, then you’ve probably
only stopped a child process, and you will need to find the parent process
that spawned all the greedy children in the first place, because stopping the
parent will stop all the children, too. Use the process ID again in this
command:


root@server# ps -o ppid,user,command 23421

This asks Linux to show you the parent process ID, user and command for
the process number 23421. The results will look like this:

Free download pdf