Skip to content
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

Allow finders to be cached for 5 minutes #722

Merged
merged 1 commit into from Dec 6, 2018

Conversation

tijmenb
Copy link
Contributor

@tijmenb tijmenb commented Dec 6, 2018

Calling expires_in sets a Cache-Control header for a page. This commit allows finder pages to be cached. This affects proper finders like https://www.gov.uk/aaib-reports and advanced search like https://www.gov.uk/search/advanced?group=services&topic=%2Feducation. This will cause the pages to be cached by both Fastly (our CDN) and our Varnish caching layer.

We're keeping the cache TTL low because we think there's a need to see new documents quite quickly. Nevertheless, this should increase the number of cache hits, which speeds up response times and scalability by alleviating load on our origin servers.

Testing

To test this, we've set up a Gatling test (courtesy of @barrucadu) where we hit 10 different AAIB Reports URLs using 100 workers.

Before this change:

  • The maximum number of requests per second seemed to max out at 18-20
  • About 40% of requests failed
  • The test took about 31 seconds

screen shot 2018-12-06 at 14 51 48

After this change:

  • The maximum number of requests per second seemed to max out at 300
  • No requests failed
  • The test took about 4 seconds

screen shot 2018-12-06 at 14 52 26

https://trello.com/c/TiXjc60U

Calling `expires_in` sets a `Cache-Control` header for a page. This
commit allows finder pages to be cached. This affects proper finders
like https://www.gov.uk/aaib-reports and advanced search like
https://www.gov.uk/search/advanced?group=services&topic=%2Feducation.
This will cause the pages to be cached by both Fastly (our CDN) and our
Varnish caching layer.

We're keeping the cache TTL low because we think there's a need to see
new documents quite quickly. Nevertheless, this should increase the
number of cache hits, which speeds up response times and scalability by
alleviating load on our origin servers.

https://trello.com/c/whG5Wfr8
@rubenarakelyan
Copy link
Contributor

WIN 🎉

@tijmenb tijmenb merged commit c24114b into master Dec 6, 2018
@tijmenb tijmenb deleted the set-caching-headers-for-finders branch December 6, 2018 15:27
@tijmenb tijmenb restored the set-caching-headers-for-finders branch December 14, 2018 15:53
@tijmenb tijmenb deleted the set-caching-headers-for-finders branch December 14, 2018 15:53
thomasleese added a commit that referenced this pull request Jan 10, 2019
Similar to what we've done to normal finders
(#722)
we want to set approriate cache headers on the QA tool allowing it
to be cached by Fastly and Varnish.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants