Oh yea, to add some other #'s
18.5 hours CPU eaten by:
793238 of 141241791 Datastore Calls which consumed 14.56 of 1243.85
Datastore CPU hours
and did so with less than
247859 of 43200000 requests

Something does not add up.

On Aug 3, 11:26 pm, Mark Jones <mark0...@gmail.com> wrote:
> I added ~ 1/4 million simple Items last night and managed to consume
> 12 hours of CPU time in under 1.5 hours of wall clock time.
>
> Here is the model, below is the code.  I don't know how much simpler
> this could get.  Account and Tenant are essentially EMPTY objects
> having keys and their name in the Key field as well, but otherwise
> empty.
>
> class FlatItem(db.Model):
>     account = db.ReferenceProperty(Account) populated with account
>     tenant = db.ReferenceProperty(Tenant) populated with tenant
>     refersto = db.SelfReferenceProperty() None
>     when = db.DateTimeProperty()  populated
>     amount = db.FloatProperty() populated with random value
>     tax = db.FloatProperty() None
>     text = db.StringProperty(multiline=True) about 420 characters (not
> sent in request)
>     image = db.BlobProperty() None
>
>     def post(self):
>         start = datetime.now()
>         account_keys = self.request.get('account_name',
> allow_multiple=True)
>         added = 0
>         for account_key in account_keys:
>             account = Account.get_by_key_name(account_key)
>             if account == None:
>                 self.error(404)
>                 self.response.out.write("Account '%s' not found" %
> self.request.get('account_name'))
>                 return
>             try:
>                 tenant = Tenant.get(self.request.get('tenant_key'))
>                 if tenant == None:
>                     raise db.BadKeyError
>             except db.BadKeyError:
>                     self.error(404)
>                     self.response.out.write("Tenant key '%s' not
> found" % self.request.get('tenant_key'))
>                     return
>
>             when = datetime.strptime(self.request.get('when'), "%Y/%m/
> %d %H:%M:%S")
>
>             i = FlatItem(tenant=tenant, account=account,
> amount=random.random()*400, when=when,
>                      text="Flat %s blah blah blah blah..(~ 420
> characters).. blah blah blah." % account.key())
>             key = i.put()
>             added += 1
>
>         end = datetime.now()
>         s = "Added %d Flat Item(s) in %d microseconds" % (added, (end-
> start).microseconds,)
>
>         logging.info(s)
>         self.response.out.write("%s<br/><a href='/flatitems/add'>Add
> more flat items</a>" % s)
>
> Funny thing is I burned up the 12 hours I had to pay for FASTER than
> the 6.5 hours I got for free.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to