before i start note this WONT WORK ON A VPS
okay lets start the command is quite simple
echo 3 > /proc/sys/vm/drop_caches
many of you will ask what does it do? simple it clears the ram cache for example here i have it where i did it
root@ns1 [~]# free -m
total used free shared buffers cached
Mem: 7993 7839 154 0 62 6804
-/+ buffers/cache: 971 7021
Swap: 2046 0 2046
root@ns1 [~]# echo 3 > /proc/sys/vm/drop_caches
root@ns1 [~]# free -m
total used free shared buffers cached
Mem: 7993 885 7107 0 2 45
-/+ buffers/cache: 837 7156
Swap: 2046 0 2046
root@ns1 [~]#
please not the numbers under "used" first it says used 7839 then it says used 889
now we dont want to have to do this everytime do we?
so we open up a shell console as root and type
crontab -e
this will open a editor with all cronjobs running as root now we past this in
*/10 * * * * echo 3 > /proc/sys/vm/drop_caches
this will run the command every 10 minutes and your ram stays nice and clean which speeds the server up 🙂 have fun
foreach ($_SERVER as $server => $value)
{
echo "$server is $value<br />";
}