Giter Site home page Giter Site logo

Comments (7)

chrisroos avatar chrisroos commented on July 18, 2024

We've used Kibana to count the number of 304 responses for Mainstream assets from Asset Manager over the last 7 days (http_host:assets.publishing.service.gov.uk AND status:304 AND request:/GET \/media\/.*/ #=> 219,087).

Mainstream assets are cached for 24 hours. By changing this to 4 hours, we'd expect to see around 6 times the number of requests resulting in 304 responses from Asset Manager (i.e. 1,200,000 instead of 200,000). In the same 7 day period Asset Manager responded to 2,208,911 GET requests (application:asset-manager AND request:/GET.*/). The additional 1,000,000 requests represents nearly a 50% increase in total requests so it's not obvious this is the way to go.

from asset-manager.

chrisroos avatar chrisroos commented on July 18, 2024

We've used Kibana to count the number of 304 responses for Whitehall assets from Asset Manager over the last 7 days (http_host:assets.publishing.service.gov.uk AND status:304 AND request:/GET \/government\/.*/ #=> 1,047,031).

Whitehall assets are cached for 4 hours. By changing this to 24 hours, we'd expect to see around 6 times fewer requests resulting in 304 responses from Asset Manager (i.e. 174,505 instead of 1,047,031).

from asset-manager.

chrisroos avatar chrisroos commented on July 18, 2024

We're preparing to start serving about 1.5m Whitehall attachments from Asset Manager so we're currently thinking that it might be better to increase the cache time across the board to 24 hours.

from asset-manager.

chrisroos avatar chrisroos commented on July 18, 2024

@chrislo and I have started working on standardising the caching in #523.

from asset-manager.

chrisroos avatar chrisroos commented on July 18, 2024

The changes in #523 were merged yesterday. I've confirmed that they're working as expected in integration by requesting the same asset from integration and production and comparing the Cache-Control header. You can see that it was 4 hours in production (the previous value) and it's now 24 hours in integration (the new value).

# Production
$ curl -v "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/person/image/6/s216_PM_portrait_960x640.jpg" > /dev/null

< Cache-Control: max-age=14400, public

# Integration
$ curl -v "https://assets-origin.integration.publishing.service.gov.uk/government/uploads/system/uploads/person/image/6/s216_PM_portrait_960x640.jpg" > /dev/null

< cache-control: max-age=86400, public

from asset-manager.

chrisroos avatar chrisroos commented on July 18, 2024

These changes have now been deployed to production and I've confirmed that the Cache-Control header is now set to 24 hours:

$ curl -v "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/person/image/6/s216_PM_portrait_960x640.jpg?CJR$RANDOM" > /dev/null

< Cache-Control: max-age=86400, public

from asset-manager.

chrisroos avatar chrisroos commented on July 18, 2024

This is all done. Closing.

from asset-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.