EE compatibility updates:

  • Publisher is EE5 compatible, but it does not currently support the Fluid field.

ExpressionEngine.com licenses:

  • If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Questions about static cache

Status Client Wait
Add-on / Version Speedy 1.1.1
Severity
EE Version 5.2.3

Gregory Maher

Sep 23, 2020

Hi Brian,
I hope all is well. I have a few questions about the static caching capabilities of Speedy. We have it setup on a site that we’re anticipating will receive significant (for this site) traffic this weekend. Last weekend was ~100,000 unique visitors over a three day span with surges at three specific times during a live stream broadcast. The site slowed/crashed a couple of times using built in ExpressionEngine memcached caching.

It’s a small site (~12 pages) and things seems to be working as designed. When running load tests on the static cached environment of the site we’re able to easily send over 100,000 users over the course of 2 minutes to 1-2 pages and the response times are generally between 10-100ms. Very cool!

I have a couple of questions about how the static caching works.

1. The TTL parameter does not seem to respect the value. It defaults correctly to 1 hour. However, if I change it to “0” it still shows as expiring in 1 hour in the CP. If I change it to “86400” (24 hours) it shows as expiring in 1 minute in the CP.
2. Is further caching (edge, browser, etc…) of the static pages recommended/possible?

Do you have any other recommendations for us knowing that a majority of our traffic will be concurrent, to only a handful of pages?

Thanks in advance! We’re looking forward to seeing how this holds up!

Greg

#1

Gregory Maher

Sep 23, 2020

And, as a quick followup…

We have Cloudflare setup for our site. Is there a way for Cloudflare to take advantage of the static pages generated by Speedy?

#2

BoldMinded (Brian)

Sep 23, 2020

Was the 100k users with our without Cloudflare in place?

1) which TTL value are you referring to? You’re using static files, right?

2) I honestly don’t know. If you’re able to handle 100k users in 2 minutes I think that’s pretty good 😊

3) Not sure what you mean by take advantage of the static pages. I’ve never actually used Cloudflare before tbh. Are you referring to warming Cloudflare’s cache somehow?

#3

Gregory Maher

Sep 23, 2020

Hi Brian,
1) I’m referring to the TTL parameter in the {exp:speedy:static} tag.  For example, {exp:speedy:static ttl=“21600”} works fine, but changing that “0” or “86400” does not seem to work.
2) I’m still working on understanding the tests, but the results have been pretty promising.
3) I’m trying to get Cloudflare to cache the static pages and deliver them without touching the server. I’m not sure if that’s possible though. No worries there.

Thanks for the always awesome support, Brian!

Greg

#4

BoldMinded (Brian)

Sep 23, 2020

1) I’ll take a look, maybe it’s not overriding correctly.
3) Isn’t that what Cloudflare just does magically? You point it to your site and it somehow caches the page’s output and serves it from their CDN?

#5

Gregory Maher

Sep 23, 2020

It is, but it takes a little configuration to cache HTML.

See here: https://support.cloudflare.com/hc/en-us/articles/360021023712-Best-Practices-Speed-up-your-Site-with-Custom-Caching-via-Cloudflare-Page-Rules

A quick thought here…
Cloudflare states: Resources that match a Cache Everything Page Rule are still not cached if the origin web server sends a Cache-Control header of max-age=0, private, no-cache, or an Expires header with an already expired date. Include the Edge Cache TTL setting within the Cache Everything Page Rule to additionally override the Cache-Control headers from the origin web server.

Does this apply to Speedy?

#6

BoldMinded (Brian)

Sep 23, 2020

If you look at the static files Speedy creates you’ll see the headers it sets. This is what I have in my local environment in a static cache file:

header('X-Frame-Options: SAMEORIGIN');
            header('Expires: Tue, 28 Jul 2020 19:37:42 GMT');
            header('Last-Modified: Tue, 28 Jul 2020 18:37:42 GMT');
            header('Pragma: no-cache');
            header('Content-Type: text/html; charset=UTF-8');

So it looks like it does set the no-cache option, at least in my local environment. All the headers are actually set from EE’s ee()->output->headers array, so if you can figure out how to remove the Pragma: no-cache header in that array (or maybe it isn’t even set for you), then you might be good to go for Cloudflare.

Login to reply

For add-on support, please use the Support section. General inquries and pre-sale questions can be sent to support@boldminded.com.