Riley Lark
Riley Lark

Reputation: 20890

Appengine Instance Hours vs. CPU Time

My app currently uses about 2 hours of CPU time a day, but uses over 100 instance hours. Does this mean that each instance is, on average, only working 2% of the time?

I want to optimize my system to use as few instance hours as possible. What's a reasonable usage percentage to aim for?

Upvotes: 2

Views: 1445

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

Yes, that is roughly your average CPU utilization.

The number one thing you can do to reduce instance hours and improve CPU utilization is to parallelize your code, doing as much work simultaneously as possible. Tools like Asynchronous URLFetch and the Async Datastore API will help with this. The NDB library, though still experimental, makes writing code that uses RPC parallelism a lot easier.

The best way to identify the low-hanging fruit for this sort of optimization is to run App Stats on your app, and examine what RPCs you spend the most time waiting for, and see if you can do other things while you wait for them to complete.

The utilization percentage you should expect depends hugely on what you're doing. You could get 100% if you're mostly CPU bound, or you might not be able to improve on 2% if your app is entirely serial in nature.

Upvotes: 1

Related Questions