In this article I’m going to touch on why excessive amounts of CPU processing especially related to image manipulation can be a bad thing on your account.
What is excessive CPU processing?
On a server the CPU or Central Processing Unit can be thought of much like the brain of the machine, almost any request the server has to deal with, is going to require time from the CPU to process that request.
The level of CPU processing for a website should be very minimal compared with local desktop CPU activities, and realizing the impact on the server’s CPU your website could be having, can help prevent you from possibly running into an account suspension for having your account use up an excessive amount of CPU time.
As an example an average WordPress site with a few plugins enabled on it and no form of caching, will typically consume around 1 second of CPU time, that is, it requires the attention of the CPU for at least 1 second before it can spit back to the website visitor the full HTML code for their web-browser to display.
Most CPU activites that happen on the server will be in the range of fractions of a second of CPU time, to maybe at most 5 CPU seconds per execution. Where you can begin to run into problems is when you’re doing more intensive CPU activities that typically would be ideal on a desktop CPU, but not a server CPU that is being shared by other users.
One of the most common instances of excessive CPU processing would be from image manipulation. If you’ve ever loaded up PhotoShop or some other image software on your desktop PC, you might have noticed when you try to resize a large image, or run certain filters on an image it can take a long time to accomplish. All along you are probably doing this on a dedicated desktop PC that has probably 2 or more processors dedicated solely to your tasks with nothing else going on in the background.
On a server, especially if you’re using shared hosting instead of a VPS or dedicated server, there are multiple CPU cores, but they are constantly being requested to do little spurts of work to fulfil all the various website requests from all the users on the server. When you all of the sudden queue up 50 large image manipulation tasks for the CPU to handle, this can throw a wrench in the server being able to keep up with all requests globally, not to mention it can eat up close to a minute of CPU time per image manipulation, which would equate roughly to the same as serving up a standard WordPress site to 60 unique visitors.
It’s generally recommended when uploading images into an application that is going to resize or manipulate the image data on the server-side, that you first use a local desktop image application to optimize the images for the web prior to uploading them. This will allow you to upload more images, faster, and without as much risk to your account’s resource usage becoming excessive.