Now that it has been up for a few hours.

 

Cache hit rate would be a lot higher but this app serves a lot of search
queries which are Robo-Generated if that traffic were ignored we'd be
sailing along at about 60% EdgeCache Hits for the first hours of testing.
This is on our "pre-production" service so we'll bake for a bit before we
have numbers across all the entire service in a more "natural" environment.
We also have to populate the cache at this point and we don't yet know how
long that takes which may raise the numbers even more.

 

 



 

From: [email protected]
[mailto:[email protected]] On Behalf Of Jeff Schnitzer
Sent: Saturday, November 19, 2011 3:57 PM
To: [email protected]
Subject: Re: [google-appengine] Cached Requests

 

Wow, this is exactly the kind of information I have been desperately looking
for.  If you're ever in the Bay Area I will buy you as many drinks as you
can stand.  Or sit.  Or pass out into some hottie's lap.

 

Jeff

On Sat, Nov 19, 2011 at 6:42 PM, Brandon Wirtz <[email protected]> wrote:

I have fought back and forth with issues related to the Edge cache.
Sometimes it would work, sometimes it wouldn't sometimes it would hold on to
files way too long. 

 

Well it hadn't been working at all for like 6 weeks, and I didn't mess with
it, but I got around to it today.  

 

If you want edge caching to work you need to make sure you have done the
following things

 

1.       Set Public   If you don't set public it won't be cached ever.

2.       Set a max-age . If you set public but don't specify max-age it
won't be cached

3.       Use a comma.  public, max-age=300 works fine.  Public; max-age=300
does not.

4.       Set an age greater than 60. 61 seems to cache. 60 does not.  There
is probably some volume to will I cache based on expiration but 61 seconds
at the volumes we run seems to cache and 60 doesn't ever seem to.

5.       Set an age less than 366 days.  364 days seems to work 365 works
most the time 366 never seems to work.  So those "Expire never" kinds of
posts people talk about for versioned assets that never expire.  Well 10
years is not the right answer.

6.       Expires with a date, doesn't seem to help, and seemingly may
prevent caching in some instances.  I think this may be clock drift. Or
something about how picky the parser is about the format of the date.
Things that work in browsers don't always work correctly in the edgecache.
(like the Semi vs the comma)

7.       Set both Pragma and Cache-Control  If Pragma is not set Public then
Cache-Control seems to be ignored.

 

This is all way more info than you probably need, but. Here is the relevant
code.

 

 

Here is the python code to set headers for caching  (CACHE_EXPIRE is a
variable we set based on the page type)

 

    self.response.headers['Cache-Control'] = 'public, max-age=%d' %
CACHE_EXPIRE

    self.response.headers['Pragma'] = 'Public'

 

This is also available at
http://www.xyhd.tv/2011/11/industry-news/setting-cache-control-headers-in-py
thon-to-take-advantage-of-google-appengines-edgecache/

 

-- 
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]
<mailto:google-appengine%[email protected]> .
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.

 

-- 
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.

-- 
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.

<<image001.png>>

Reply via email to