CPU minutes

From DreamHost
(Redirected from CPU Minutes FAQ)
Jump to: navigation, search

We measure server resource consumption in CPU minutes. This number indicates how much time a processor spends working for your username. Our policy on CPU usage is that you can use as much as you would like as long as you do not affect the server or other customers. If you are able to optimize your site correctly, you can use up to 300+ CPU minutes without causing issues, though if your services are not optimized or just very inefficient you can easily bring down a servers performance with very little CPU usage.

Average shared hosting customers normally use less than 5 CPU minutes per day for their account, so you may want to gauge this with your usage to give you an idea of how much you are using up.

It should be noted that bandwidth and CPU usage are very different and do not measure the same resource.

Examples

Take the example of serving a single image: On one hand, you could have a static image that you link to. This would only use the CPU necessary for the very optimized Apache program to load the image and send it in response. Now imagine you want to return a random image from a list of images, so you invoke PHP to pick a random image location. You incur the CPU cost of loading PHP, but the overall CPU usage is still small.

Now imagine that you want to return a random image from your most recent vacation. You have uploaded all your images in their original size but you want to send it to the visitor as only a 640x480 image so you load the original image and resize it in PHP. Now you have incurred a very high computation cost to recreate the image in a new size.

In each case you are sending the same amount of information and therefore using the same amount of bandwidth. The process of optimizing your software is finding ways to cut down on unneeded computations. In this example, you could resize the images once on your personal computer before uploading them. Then serve the previously resized image.

Another possible reason for high CPU minutes is described by a customer here:

"I run a blog as part of my site and using the daily stats provided by DreamHost on my server (http://domain/stats). I realized that two pages have become spam link magnets. I get thousands of hits on these two pages every day (referrer links are all porn or viagra etc). Both of these pages are also PHP pages - one tracks referrer hits to my site, the other has the word "video" in it is why I think the porn spam is linking to it. But I realized that if I just remove those two files, that would take away most of my CPU time that's being "stolen" by the spam pirates."

It should be noted that not everyone gets their service turned off because they received a heavy usage email. We will generally give our customers time to respond and allow them to work on reducing their usage before taking action. Keep in mind though, we do reserve the right to disable (even temporarily) any domain that is causing problems for the other customers who are hosted on the same shared server. For instance, in a case with no response in over a month we would eventually have to turn the site off. For some, there are just warnings that the usage is high. Others with even higher usage are moved to a server with less customers on it to limit the number of customers affected by very high CPU usage. If runaway process usage is not limited, the machines the processes are on become unstable and crash. The idea here is to keep machines stable. There is work involved in optimizing your website, but that is an integral part of what it means to be a web designer.

If you see a number referenced as CPU seconds, simply divide by 60 to get CPU minutes.


How To

1. Enable "CPU Reporting" (for shared hosting user accounts only)

In your DH Panel > Users > Manage Users > Edit

Check "CPU Reporting" and "Save Changes"

2. View your CPU usage

Apparently the server only processes the data once a day. You may need to wait up to 24 hours to see results.

The files are only viewable by FTP and will be located in:

/home/username/logs/resources