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-python-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 google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
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.
On Nov 19, 8:06 pm, "Brandon Wirtz" <drak...@digerat.com> wrote:
> 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: google-a...@googlegroups.com
> [mailto:google-a...@googlegroups.com] On Behalf Of Jeff Schnitzer
> Sent: Saturday, November 19, 2011 3:57 PM
> To: google-a...@googlegroups.com
> 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 <drak...@digerat.com> 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 athttp://www.xyhd.tv/2011/11/industry-news/setting-cache-control-header...
> 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 google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com
> <mailto:google-appengine%2Bunsu...@googlegroups.com> .
> For more options, visit this group athttp://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 google-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengi...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/google-appengine?hl=en.
>
> image001.png
> 27KViewDownload
I’m pessimistic that even if we got information that it would “STAY” accurate. Caching has worked, and then not worked, and then worked again…
The “best” thing I can tell you. If you set cache headers to 5 minutes (300) Things will get cached. Pages we had set this way have always worked. Things under 60 seconds have almost never worked. Things over 1 year have turned off and on. Over the past months.
I would love to get information about edgecache, but as you pointed out no one ever wants to talk about it.
--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/OLxZOV-beg4J.
http://code.google.com/p/googleappengine/issues/detail?id=2258
-----Original Message-----
From: google-a...@googlegroups.com
[mailto:google-a...@googlegroups.com] On Behalf Of Stephen
Sent: Sunday, November 20, 2011 3:58 PM
To: google-a...@googlegroups.com
Subject: Re: [google-appengine] Cached Requests
http://code.google.com/p/googleappengine/issues/detail?id=2258
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.