Portal Home > Knowledgebase > Articles Database > Server Overload


Server Overload




Posted by LooInSpain, 01-20-2010, 01:08 PM
Hi all, I've recently purchased a vps server for my property portal as it grew too big for shared hosting. This site depends upon uploading properties via XML feeds and copying the photos from other websites for properties. In order to create uniform sizes, each photo is resized via imagemagick into a full size and thumbnail. All this is done via a cron job. Last night the site was shut down by the server hosts and I was informed that it had overloaded the hardware node. I've written a script to check the resources the site is using at any one time and shut down a cron job script that is close to overloading the system but the server company wont give me any indication of what limits I should set this shutdown script at. Can anyone give me an idea of what sort of limits I should stop the scripts at? This is the info I received from the server company when they shut down the site: top - 03:12:21 up 13 days, 6:42, 0 users, load average: 7.21, 6.48, 4.55 Tasks: 44 total, 5 running, 39 sleeping, 0 stopped, 0 zombie Cpu(s): 33.2%us, 3.7%sy, 0.0%ni, 63.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4190208k total, 681964k used, 3508244k free, 0k buffers Swap: 0k total, 0k used, 0k free, 0k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 10075 costafre 21 0 114m 3100 1988 R 10.7 0.1 0:00.34 convert 11955 costafre 17 0 422m 318m 7200 S 0.9 7.8 0:19.70 php5 I may be very wrong but it doesn't seem excessive to me. They tell me that the package is self-managed and can't advise memory limits for scripts, but shut it down soon enough... The server is running an Intel Xeon E5400/E5500 Series CPU with 4Gb RAM using Linux CentOS and cPanel. The software that seems to be upsetting it is imagemagick 6.5.8 Any help would be fantastic

Posted by shawn_linux, 01-20-2010, 02:25 PM
if you can give ps aux results we can see what is causing this load on server.

Posted by LooInSpain, 01-20-2010, 02:27 PM
where can i find the ps aux results? like i said im a complete noob at this and am finding my way around the new server

Posted by larry2148, 01-20-2010, 03:36 PM
You just need to log into your ssh and run the command ps aux then highlight and paste the results. Last edited by larry2148; 01-20-2010 at 03:36 PM. Reason: ps aux not ps auxf

Posted by LooInSpain, 01-20-2010, 03:56 PM
that wont help as ive disabled the imagemagick script until i can work out the maximum levels the script can run to. Nothing is running at the moment to overload the server. At the time of the overload, these were the two processes causing the overload: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 10075 costafre 21 0 114m 3100 1988 R 10.7 0.1 0:00.34 convert <-- Imagemagick 11955 costafre 17 0 422m 318m 7200 S 0.9 7.8 0:19.70 php5 <-- Cron Script

Posted by virtualcomplete, 01-20-2010, 06:03 PM
Take a look at your load average at the top right. Without knowing what CPU your on, 7 seems pretty high. If you don't have a lot of processes running, then it is most likely that the physical server is overloaded and you should contact your provider.

Posted by foobic, 01-20-2010, 06:05 PM
Many OpenVZ / Virtuozzo providers don't set hard limits on CPU usage, so for short periods your VPS can grab most of the CPU for the entire node. Often this is a good thing - allowing for snappy web-page generation for example - but if you start using it continuously you'll begin to affect all the other users on the node and then, as you've already found, the host will shut you down to protect the others. Image processing is always CPU-intensive, and it looks like your cron-script had been running for 20 minutes or so - certainly enough for it to be noticed. If you really need to hammer the CPU continuously, a dedicated server or a different virtualization solution should work better - one that offers dedicated CPU resources. But you may find that these cost more and / or offer less performance because at present (at least until your VPS is suspended) you're probably getting more than your fair share. Alternatively you could look at improving your script. eg. When it copies a photo from another website, does it cache it to avoid processing the same image again the next day? Can you put in sleep commands to reduce average CPU usage and still finish within the required time?

Posted by LooInSpain, 01-20-2010, 06:12 PM
thanks for the replies. the script currently will copy the photo from the other website, then imagemagick will resize the photo twice - one to 300px wide, and a smaller one. Then the script will move onto the next photo. There are around about 200 photos per day. This number has dropped in the last week, for the two weeks before that it was processing 6000 photos a day and not a word was said from the company. The script doesn't sleep and the photos are not stored for processing, except in the database.

Posted by LooInSpain, 01-20-2010, 06:16 PM
I've written a script to insert into the photo processing script which will stop it immediately if the cpu or memory gets too high, but what sort of limits should I put in this? I've asked the company who run the VPS but they said they can't help



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Newbie needs advice (Views: 489)
Load high.. (Views: 520)