LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   CPU Minutes Complaint from Dreamhost Support running Debian (https://www.linuxquestions.org/questions/linux-general-1/cpu-minutes-complaint-from-dreamhost-support-running-debian-390444/)

mr.wobble 12-08-2005 04:45 AM

CPU Minutes Complaint from Dreamhost Support running Debian
 
Hi,

I wondered if someone could answer a question regarding CPU minutes? My hosting provider (Dreamhost) runs Linux (Debian) and I got a mail last week stating I am using what they claim to be an unreasonable amount of system resources.

Quote:

PLEASE READ THIS ENTIRE MESSAGE VERY CAREFULLY!

Unfortunately it appears that your site is using more than your
fair share of system resources on your shared hosting machine
<hostname>. Our system has flagged your account because it is using a large number
of CPU minutes per day on <hostname>. We need you to trim down your
resource consumption considerably. Should you ignore this or subsequent warnings your
account may be moved to an evaluation server which could cause downtime.

Specifically USERNAME'S CPU minute usage for today is 74.44.

...blah

* You may also want to evaluate our dedicated server offerings at
http://www.dreamhost.com/dedicated/, which we recommend for busier
sites, sites which experience extremely high volumes of traffic and
/ or use a lot of resources. Plans start at just $99 a month.

You will continue to receive this warning message until your resource
usage goes down.
They consider 30-40 CPU min per day to be 'reasonable'. But what is a CPU minute? Is this something I should be worried about?


OK, so I checked out the resource usage files and here are some example of the output:


Quote:

Process CPU seconds user machine count average
php.cgi 4364.2100 97.764% 18.184% 45498 0.096
perl 89.2300 1.999% 0.372% 3 29.743
less 4.3700 0.098% 0.018% 5 0.874
awstats.pl 3.1100 0.070% 0.013% 3 1.037
...other entries removed for neatness
bash 0.0000 0.000% 0.000% 2 0.000
----------------------------------------------------------------------
Total: 4464.0200 100.000% 18.600% 45580
Average per day: 4464.0200 1 days
CPU percentage assumes 24000 cpu seconds per day total.
(sorry if that is difficult to read


I have done some reading about this and found out about dividing the TOTAL by 60 to put it into minutes, but still do not grasp this concept. Does the average (in the right-most column) mean that the average 'actual usage' over the 24 hour reporting period? And how does the php.cgi have so many seconds and an average of 0.096, but Perl has a lower amount of seconds but have a higher average of 29.743?

I'm assuming that php.cgi is using touching the CPU many times but using a fraction of it's capacity and Perl (from my Awstats installation) is using fewer seconds but when it does run it uses more of the CPU?

If my above assumption is true, it the whole message from my host unreasonable on their part? Or is it a bad attempt to 'sell up' the customer to a dedicated box?

My traffic has always been fairly constant and I have never been told my usage is unreasonable from any hosting provider before. Furthermore, they have a 3 month 'cancellation/money back period'. They conveniently starting notifying me 2 days outside of it - as if my usage one day all of a sudden got big!

Any advice anyone has to offer will be appreciated. I apologise in advance if this is not the right forum for this type of message. I am just interested in finding out what this all means.

Spudley 12-08-2005 07:43 AM

CPU time is the amount of time the processor has had to give to a particular task. With many programs running at once, and CPUs able to do a lot of things in a pretty short space of time, CPU time should be relatively small, even for a busy program.

I'm not sure if you're running Linux yourself or not? You didn't say. If you are, the best way to find out about CPU minutes is to run the "top" program, which shows a list of programs that are running, and how much CPU usage they're taking up (Windows has the task manager, which does a similar job, but I forget whether it shows CPU minutes).

If you run "top", you'll see a column called TIME, which is the number of CPU minutes that a program has taken since it started. For example, on my computer at the moment, Firefox (which as been running all day) has used up 8 minutes and 58 seconds of CPU time so far.

You said your traffic is consistent, but you didn't give an idea of how much you're getting, so it's hard to say for sure whether 75 mins of CPU usage in a day is excessive for you, but it certainly does sound like a lot. For a reasonably quick-running page, you'd need to be getting tens of thousands of page hits per day to get that sort of usage.

A PHP or Perl program should run and complete almost immediately (web users don't like to be kept waiting), so it shouldn't use very much CPU time at all -- a hundredth of a second or less each time it runs would be typical; anything more than a tenth of a second will produce noticeable delays (possibly even time-outs) for the web users. If it's using much more than that, it implies that the program has a very processor intensive loop somewhere in it, which probably doesn't need to be there: remove or simplify the loop, and the problem will go away.

If this is a PHP program you've written yourself, have a look at the loops, and see if there's anything that might cause it to go slowly.

I hope that helps... :)

All the best,


Spudley.

(ps -- if you want to make your stats easier to read, use the [code] tag instead of [quote] :) )

mr.wobble 12-08-2005 11:16 AM

Hi Spudley,

Yeah, I'm running FC4 at home, and am familiar with 'top', but I wondered if what is deemed to be a CPU minute could be either a program or process that could spend say 8 hours consuming 0.01% of the CPU or 99% of the CPU - and both would be counted in the same way even though the actual performance of the box would be totally different in the two examples.

As for the site and traffic, its a phpBB installation (slightly modded). Here is a summary of the stats for November:

Unique visitors
15449

Number of visits
37297

Pages
1282558 (34.38 pages/visit)

Hits
2,682,957

Bandwidth
6.28 GB

Coupled with the php usage from my original message (above)

Process
php.cgi

CPU seconds
4364.2100

user
97.764%

machine
18.184%

count
45498

average
0.096

Does the average mean I am using just under 1% of the CPU all the time? If so, I really dont think that's so much load.

They recommended a way for me to fork out which scripts are using more of the CPU resources. I don't mind doing that but before I do, I wonder if it is really worth it as if that CPU usage v's amount of traffic is 'normal' for a phpBB installation then it will be a waste of time.

What do you reckon?

Spudley 12-09-2005 06:36 AM

Hi again,

Quote:

Originally Posted by mr.wobble
..I wondered if what is deemed to be a CPU minute could be a process that could spend say 8 hours consuming 0.01% of the CPU or 99% of the CPU - and both would be counted in the same way...

The CPU minutes reflect the usage percentage of the process --- think of it as the CPU minutes gives you cumulative total, while usage % is a snapshot of the CPU usage at a given moment.

Quote:

As for the site and traffic, its a phpBB installation...
Ah, that's interesting. And it looks from the stats, as if it is actually a reasonably busy forum.

Now I know from first hand experience the sort of strain a really busy forum can put on a web server -- a friend of mine runs a very popular forum, and he's had to pay for a dedicated server to run it, because it was breaking various bandwidth/usage limits on the shared server where he started it. I haven't got his stats to hand, so I can't compare them to yours (and of course, your actual server is likely to be different from his too), but he was forced to move when his forum started getting about 100-150 new posts per day.

Quote:

Does the average mean I am using just under 1% of the CPU all the time? If so, I really dont think that's so much load.
75 mins in a day.... works out more like 5%. Which is quite a load if you consider that a shared hosting server probably has over a hundred sites on it. (also that 5% is over the whole day, so it would be spiking at busy periods to a lot more than that)

Quote:

They recommended a way for me to fork out which scripts are using more of the CPU resources. I don't mind doing that but before I do, I wonder if it is really worth it as if that CPU usage v's amount of traffic is 'normal' for a phpBB installation then it will be a waste of time.

What do you reckon?
Having seen all the stats, I'm not sure what to suggest. I'm not an expert with phpBB; I have run sites with it, but none that were big enough to need me to monitor stats like CPU usage, so I don't really know what would be normal for it, but I did say you'd need to be getting tens of thousands of page views to get that sort of usage, and that is what you've got, so it certainly doesn't look like your figures excessively high for that amount of traffic.

If you can find a phpBB mod that allows you to cache pages it will help with the CPU load -- save yourself a bit of database traffic if lots of people are viewing the same page at the same time.

Other than that, I'm not sure. Hope I've been of some help, though.

mr.wobble 12-09-2005 08:10 AM

Hello Spudley,

Yeah, thanks. Thats loads of help. At least I know where I stand. I am a total n00b when it comes to site usage v's machine resource usage - this year the forum's popularity has really mushroomed which on the one hand is great, but on the other hand I am now likely to incur greater financial costs (dedicated server) or risk having to shut up shop (perfer not to).

I've just never been in this position before and I felt that dreamhosts mail was perhaps a little 'untimely' and contrived (sent 2 days after the 90 day cancellation period).

Anyways, you have a good weekend and thanks for your help! I'm off out to the company christmas piss up ;-)

Cheers,

Mr Wobble


PS already installed xs_mod which does caching. Unfortunately it didnt really make any kind of a dent (reduction) in the processor usage.


All times are GMT -5. The time now is 12:19 PM.