Hi Kevin,

On Wed, Aug 26, 2009 at 11:30 PM, Kevin Gadd <[email protected]> wrote:

>
> I have a simple prototype of a service running successfully on app
> engine, using the python runtime. For the most part, things are
> working well. However, I'm continually getting warnings on the
> dashboard about how my requests are about to exceed their CPU quota.
> This is a bit mystifying since I haven't found any documentation
> anywhere describing a per-request CPU quota - is it referring to the
> overall CPU quota?
>

There used to be a per-URL CPU quota. The message text is somewhat out of
date, unfortunately - treat it as a warning that some pages have unusually
high CPU usage.


> I've already profiled my services using cProfile and see no obvious
> bottlenecks in my python, other than the inherent inefficiency of the
> python protocol buffers implementation used by the datastore - and
> regardless, my services' python only appears to be consuming a few
> hundred milliseconds of CPU time. Almost all of the CPU time consumed
> seems to be from the datastore.
>
> Is there some way I can profile the datastore requests to figure out
> what it is about my entities that causes them to take so much time to
> submit? I'm storing relatively simple expando entities in batches of
> 6-8 at a time and this is consuming over ten seconds worth of API CPU
> time per batch, and I really can't come up with a plausible
> explanation for why this would be so expensive. Are there some good
> rules of thumb or guidelines for how I can avoid spending large
> amounts of CPU time to store data?
>

How many batches are you updating in a page? Are you doing each batch in a
single db.put() operation, or one put per entity? And how many custom
indexes do you have for these entities?

-Nick Johnson


> For reference, here is how I have defined the entity:
>
> class Event(db.Expando):
>  playerId = db.IntegerProperty()
>  sessionId = db.IntegerProperty()
>  timeMs = db.IntegerProperty()
>  eventType = db.StringProperty()
>
> And here is what a sample entity looks like:
>
> {
>  "playerId": 1115,
>  "eventType": "BotchedCombo",
>  "sessionId": 233,
>  "timeMs": 261986,
>  "eventData": 4,
>  "playerX": -523,
>  "playerY": 248,
>  "levelName": "drowned_queen_arena"
> }
>
> I simply cannot figure out how it would take so much time to store
> these entities. I considered the possibility that it was overhead from
> indexing all my expando values, but the little documentation I did
> find suggested that expando values are not indexed, in which case the
> cost of indexing these entities should be trivial.
>
> Thanks in advance,
> -kg
>
> >
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to