Calculate CPU Hours that app will use

104 views
Skip to first unread message

mclovin

unread,
Jun 13, 2009, 8:13:52 PM6/13/09
to Google App Engine
I wanted to see if an app would be cost effective to deploy on
google's app engine and i guess one of the main areas i am concerned
with is CPU usage. Is there a way to calculate how many CPU hours it
will use on Google's servers? (the app is already running on my
computer via django) I dont think an hour of CPU time on my computer
is comparable to a "CPU Hour" but I guess I may be wrong.

CarstenN

unread,
Jun 14, 2009, 5:51:24 AM6/14/09
to Google App Engine
I'm interested in the same. I know that you can get the clock-cycles a
request used so far by calling quota.get_request_cpu_usage(), but I
don't find this to be very useful as an absolute measurement.

The docs state (on the quota page): 'CPU time is reported in
"seconds," which is equivalent to the number of CPU cycles that can be
performed by a 1.2 GHz Intel x86 processor in that amount of time. The
actual number of CPU cycles spent varies greatly depending on
conditions internal to App Engine, so this number is adjusted for
reporting purposes using this processor as a reference measurement.'

So, in theory, a CPU second would be about 1.2 billion clock cycles.
But I highly doubt it works that way in practice. So my current
solution is to just implement the CPU intensive parts and hit them
with a load test (And have a backup plan in case the CPU usage
policies change again).

IMHO this is something that Google really needs to improve. App Engine
does lack transparency in some areas - and given that it's a product
meant to appeal to engineers that's a real flaw.

Nick Johnson (Google)

unread,
Jun 15, 2009, 8:34:20 AM6/15/09
to google-a...@googlegroups.com
Hi Carsten,

You're correct that the best way to do this is to run the code on App Engine and see just how many CPU cycles your requests require. You don't need a load test, however: You can see exactly how many CPU milliseconds a request required by looking at the logs page of the admin console. Just run a few tests to get an average. Note that the first request to a runtime instance will generally cost more than subsequent ones; you may want to make this clear by logging something in a request when it's the first one, so you can tell them apart easily.

CPU cycles are infuriatingly difficult to convert, with different architectures having different characteristics, even down to per-operation differences. What did you have in mind when you suggest it's something we need to improve?

-Nick Johnson

mclovin

unread,
Jun 18, 2009, 1:50:22 PM6/18/09
to Google App Engine
Ok, so my output from Carsten's suggestion was an average of about
7800, so how exactly does that correlate with how much I would be
paying (obviously per request) if I was to launch my app on the GAE? I
just need a very rough estimate so I can estimate the long term costs.

Also how much CPU usage does it take for Google to red flag your app
for too much CPU usage if you use paid billing? It would be
unfortunate if I launched my app and then all my requests from users
timed out because of Google blocking my account because of CPU usage
even if I was paying for it.


On Jun 15, 5:34 am, "Nick Johnson (Google)" <nick.john...@google.com>
wrote:

Nick Johnson (Google)

unread,
Jun 19, 2009, 6:34:46 AM6/19/09
to google-a...@googlegroups.com
On Thu, Jun 18, 2009 at 6:50 PM, mclovin <hano...@gmail.com> wrote:

Ok, so my output from Carsten's suggestion was an average of about
7800, so how exactly does that correlate with how much I would be
paying (obviously per request) if I was to launch my app on the GAE? I
just need a very rough estimate so I can estimate the long term costs.

Multiply the average number of CPU-seconds for a page by the number of hits per day you expect it to get.
 


Also how much CPU usage does it take for Google to red flag your app
for too much CPU usage if you use paid billing? It would be
unfortunate if I launched my app and then all my requests from users
timed out because of Google blocking my account because of CPU usage
even if I was paying for it.

We won't block you for using 'too much' of any paid quota, as long as you haven't hit your billing limits.
 
-Nick Johnson




--
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047
Reply all
Reply to author
Forward
0 new messages