Replace resources cache with stale headers#138
Conversation
|
And here we are full circle — #31 Code looks fine, I'm all for slimming solidus down. I am curious about concurrency however. Have you done any surge testing to get an idea? Looking at a range of sites for the past 24 hours in Heroku most seem to only get about ~20 requests/min (or less), with some spikes here and there doubling that. I wish I had much more historical data to review but that doesn't seem like much to be worried about. With resources taking much longer to fetch though I wonder about worst case scenarios where a request for a page could start to near Heroku's hard request timeout of 30 seconds. If we're being scanned by a crawler a fair number of requests across a range of URLs would be requested, at some point won't requests start to stack up even with Fastly in front? In those cases at least Fastly would keep retrying, maybe having a throttling effect, but I'm wondering about the threshold (and possible scenarios leading to it) that leaves us no choice but to add additional dynos. That 1 second cache was maybe targeted at some issues in this area but there's nothing documented from that time. Disappearing resources due to timeouts were definitely a thing though for awhile.. |
|
I did some local tests with I also did a few more "realistic" tests, like launching 5 site crawlers at the same time on youngmoney.com. The site held just fine, even though the general response time of Heroku was higher. The key is of course a good CDN. This PR moves the performance considerations from Solidus to Fastly. With the 24h I think we should run this code live with a few sites for some time, and see how it goes. So far it seems to be working fine, but if problems arise we'll have to trade "resource freshness" with "performance"... |
|
👍 let's see how it goes, the resource freshness is pretty fresh right now! |
bdbc3be to
125f62a
Compare
|
This is now running on thelumineersfanclub.com |
|
You can also use the #139 branch, for a faster response time. |
Long overdue update. Recommends a CDN for high traffic uses and an API proxy with the removal of Solidus caching in 3.x. Removes references to older platforms (Nodejitsu!) and technologies (Grunt, solidus-site-template). Misc. style tweaks and quick language edits.
Since most Solidus sites (those by @SparkartGroupInc at least) are behind a cache like Fastly, and use resources proxied with a cache too, it's not very useful for Solidus to have its own resources cache. This pull request:
stale-while-revalidateandstale-if-errorcaching headers, set to 1 day. To prevent the user from waiting for the longer pages.Last-Modifiedheader. Its value was random anyway,ETagis much more accurate.Cache-Control: max-ageandExpiresheaders to the nearest resource expiration date. This will make resources changes appear quicker on the live sites. This new expiration date is capped at 5 minutes, in case we get resources will really long expirations.