The default cache setting is no-cache, the browser will revalidate the
same image ever time the image being displayed.
You may try to set this explicitly to a week.
self.response.headers['Cache-Control'] = 'public, max-age=630000'

On Sep 24, 10:59 pm, iceanfire <[EMAIL PROTECTED]> wrote:
> I'm still having trouble with high-cpu warnings for thumbnails. This
> time around I took some profiler data to see what's causing it. But
> before I get into that here is the model i'm using:
>
> class ImageThumb(db.Model):
>   binId = db.IntegerProperty()
>   thumb = db.BlobProperty(default=None)
>   building = db.ReferenceProperty(Buildings)
>   apartment = db.ReferenceProperty(Apartments)
>   mime = db.StringProperty()
>   type = db.StringProperty(choices=['Floor Plan','Picture'])
>   created_by =  db.UserProperty()
>
> So here's the Profiler cpu data:
> 2538 function calls (2472 primitive calls) in 0.028 CPU seconds (rest
> of the data:http://docs.google.com/Doc?id=dgfxff5_30hc9tjsgg)
>
> But here's the warning: This request used a high amount of CPU, and
> was roughly 1.3 times over the average request CPU limit. High CPU
> requests have a small quota, and if you exceed this quota, your app
> will be temporarily disabled.
>
> Here's the megacycle info from the new Admin console: 1339mcycles 7kb
>
> Here's the code that pulls up the data for thumbnails:
> class Apt_thumb (webapp.RequestHandler):
>     def get(self,id):
>                 image = ImageThumb.get_by_id(int(id))
>                 if image:
>                         self.response.headers['Content-Type'] = 
> str(image.mime)
>                         self.response.out.write(image.thumb)
>                 else:
>                         self.error(404)
>
> The images stored are 4kb each in the datastore. As I said, I had this
> problem earlier, so I had taken out the full image and put that in its
> own Model. Clearly that didn't help.
>
> Any idea what's causing this high-cpu error & how I can fix it?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to