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

Projects
None yet
4 participants
@tijmenb
Copy link
Member

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

Allow finders to be cached for 5 minutes
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

This comment has been minimized.

Copy link
Contributor

rubenarakelyan commented Dec 6, 2018

WIN 🎉

@tijmenb tijmenb merged commit c24114b into master Dec 6, 2018

3 checks passed

continuous-integration/jenkins/branch This commit looks good
Details
continuous-integration/jenkins/publishing-e2e-tests Publishing end-to-end tests succeeded on Jenkins
Details
continuous-integration/jenkins/security No security issues found
Details

@tijmenb tijmenb deleted the set-caching-headers-for-finders branch Dec 6, 2018

@tijmenb tijmenb restored the set-caching-headers-for-finders branch Dec 14, 2018

@tijmenb tijmenb deleted the set-caching-headers-for-finders branch Dec 14, 2018

thomasleese added a commit that referenced this pull request Jan 10, 2019

Allow caching the QA in Fastly and Varnish
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