-
-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Cache-Control headers on AP endpoints #180
Conversation
Includes: * AP Collection fetching via canonical URL * AP Collection fetching via API * AP Post fetching via canonical URL * AP Post fetching via API Ref T693
I'm not sure if you did any benchmarks but I did 😁 on the collection endpoint Without Varnish:
With Varnish:
And with Varnish in the middle but before the pages are cached the transaction times were:
That's just with two iterations of 255 concurrent users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good and the cache control header is working as expected on the specified end points.
I also tested response times again using wrk, matt is still just Nginx and rob is with Varnish:
~/c/wrk (master|✔) $ ./wrk -t8 -c1000 -H "Accept: application/activity+json" https://matt.writefreely.dev
Running 10s test @ https://matt.writefreely.dev
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 475.32ms 187.24ms 1.98s 81.42%
Req/Sec 109.66 50.04 272.00 68.52%
7587 requests in 10.08s, 10.51MB read
Socket errors: connect 208, read 3752, write 0, timeout 21
Requests/sec: 752.60
Transfer/sec: 1.04MB
~/c/wrk (master|✔) $ ./wrk -t8 -c1000 -H "Accept: application/activity+json" https://rob.writefreely.dev/log
Running 10s test @ https://rob.writefreely.dev/log
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 268.45ms 169.69ms 1.95s 90.81%
Req/Sec 212.60 92.59 630.00 70.68%
15536 requests in 10.09s, 3.40MB read
Socket errors: connect 159, read 3170, write 0, timeout 66
Requests/sec: 1539.76
Transfer/sec: 345.50KB
This one supports more concurrent connections, set at 1000 here.
Nice! Thanks for the thorough testing / benchmarking -- I hadn't done that 😄. And to be sure, this only introduces caching on ActivityPub endpoints where we're doing |
Yep, the other requests include the |
Actually good call @thebaer, it seems to be caching the post fetch endpoint even without the header for activity json. |
Gotcha. So I think this might be a varnish thing, where we include the |
Got it, I just added a case in the subroutine for receive
|
Thanks, let's continue that discussion on writefreely/documentation#7 -- I think there are some other things we might want to tweak. For now, I'll merge this in. |
This enables future use of Varnish in front of WriteFreely (see T693 for details).
Includes:
(By "ActivityPub fetching" I mean requests with the header
Accept: application/activity+json
)This closes T693.