|Cached Requests||Brandon Wirtz||11/19/11 2:42 PM|
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'
|Re: [google-appengine] Cached Requests||Jeff Schnitzer||11/19/11 3:56 PM|
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.
|RE: [google-appengine] Cached Requests||Brandon Wirtz||11/19/11 5:06 PM|
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
|Re: Cached Requests||bFlood||11/20/11 9:22 AM|
thank you brandon, great info!
On Nov 19, 8:06 pm, "Brandon Wirtz" <drak...@digerat.com> wrote:
> 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.
> files way too long.
> Things that work in browsers don't always work correctly in the edgecache.
> This is all way more info than you probably need, but. Here is the relevant
> This is also available athttp://www.xyhd.tv/2011/11/industry-news/setting-cache-control-header...
> <mailto:google-appengine%2Bunsubscribe@googlegroups.com> .
> For more options, visit this group athttp://groups.google.com/group/google-appengine?hl=en.
|Re: Cached Requests||vlad||11/20/11 12:18 PM|
Can we get a confirmation from GAE team on this information? I know they do not want to touch caching issue...But many developers are interested and it would be the worst outcome if we go on second hand information which might be bogus through no fault of Brandon's.
|RE: [google-appengine] Re: Cached Requests||Brandon Wirtz||11/20/11 2:08 PM|
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.
From: google-a...@googlegroups.com [mailto:google-a...@googlegroups.com] On Behalf Of vlad
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.
|Re: [google-appengine] Cached Requests||Stephen||11/20/11 3:57 PM|
|RE: [google-appengine] Cached Requests||Brandon Wirtz||11/20/11 8:35 PM|
You could have considered giving me a citation... I mean... If you are
going to steal my comments spelling errors and all.
You received this message because you are subscribed to the Google Groups
To post to this group, send email to google-a...@googlegroups.com.
|Re: Cached Requests||sb||11/20/11 8:45 PM|
He did cite it, there is a link to this very discussion.