Link Header-based Invalidation of Caches
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Link Header-based Invalidation of Caches

on

  • 3,463 views

Gateway caches are intermediary components for reducing demands on destination servers, and therefore operational costs of a system. At scale, particularly with the advent of on-demand infrastructures ...

Gateway caches are intermediary components for reducing demands on destination servers, and therefore operational costs of a system. At scale, particularly with the advent of on-demand infrastructures such as EC2, etc., maximising cache efficiency translates into cost efficiency, resulting in a competitive advantage. In this position paper, we initially discuss advantages and limitations of HTTP caching mechanisms. We then propose to use HTTP Link: headers to maximise the efficiency of gateway (or reverse proxy) caching mechanisms and discuss early findings.

Statistics

Views

Total Views
3,463
Views on SlideShare
2,331
Embed Views
1,132

Actions

Likes
1
Downloads
12
Comments
0

37 Embeds 1,132

http://restafari.blogspot.com 657
http://restafari.blogspot.co.uk 84
http://restafari.blogspot.de 59
http://restafari.blogspot.com.es 45
http://restafari.blogspot.se 34
http://restafari.blogspot.ca 30
http://restafari.blogspot.fr 24
http://restafari.blogspot.com.br 23
http://restafari.blogspot.nl 15
http://restafari.blogspot.in 14
http://restafari.blogspot.com.au 11
http://restafari.blogspot.ru 11
http://restafari.blogspot.mx 9
http://restafari.blogspot.fi 9
http://restafari.blogspot.pt 9
http://restafari.blogspot.it 9
http://restafari.blogspot.co.nz 9
http://restafari.blogspot.ch 8
http://restafari.blogspot.com.ar 8
http://restafari.blogspot.no 8
http://restafari.blogspot.be 6
http://restafari.blogspot.dk 6
http://restafari.blogspot.ie 5
http://restafari.blogspot.ro 5
http://restafari.blogspot.cz 4
http://restafari.blogspot.jp 4
http://restafari.blogspot.co.at 4
http://207.46.192.232 3
http://restafari.blogspot.sg 3
http://restafari.blogspot.sk 3
http://translate.googleusercontent.com 3
http://restafari.blogspot.hu 3
http://www.slideshare.net 2
http://restafari.blogspot.gr 2
http://restafari.blogspot.hk 1
http://restafari.blogspot.kr 1
http://restafari.blogspot.co.il 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Link Header-based Invalidation of Caches Presentation Transcript

  • 1. Using HTTP Link: Header for Gateway Cache Invalidation Mike Kelly <mike@mykanjo.co.uk> Michael Hausenblas <michael.hausenblas@deri.org>
  • 2. What is a gateway cache? "reverse proxy cache" A layer between all clients and destination server Objective: Minimize demand on destination server Not so concerned with reducing bandwith
  • 3. How do they work? They can leverage the 3 principal caching mechanisms: • Expiration • Validation • Invalidation HTTP has mechanisms for each of these
  • 4. Expiration-based caching < 200 OK < Content-Type: text/html < Cache-Control: public, s-maxage=600 < .... Pros: + Simple + No contact with server until expiration Cons: - Inefficient - Difficult to manage
  • 5. Validation-based caching < 200 OK < ETag: "686897696a7c876b7e" > GET /example > If-None-Match: "686897696a7c876b7e" < 304 Not Modified Pros: + Reduces bandwidth + Ensures freshness Cons: - Server handling every request - Generating 304 still costs processing and I/O
  • 6. Expiration+Validation caching < 200 OK < ETag: "686897696a7c876b7e" < Cache-Control: public, s-maxage=600 Pros: + Expiration reduces contact with server + Validation reduces bandwidth Cons: - "Worst case" inefficiency - Still managing caching rules
  • 7. Invalidation-based caching - Responses fresh until invalidated (by non-safe requests) In HTTP: PUT POST PATCH DELETE (PURGE?)
  • 8. How is this possible? Product of adhering to constraints of REST, particularly: Uniform Interface + Self-descriptive messages Intermediaries can make assertions about client-server interactions.
  • 9. Invalidation-based caching Pros: + Caches have self-control + "Best case" efficiency + Ensured freshness* Cons: - Only reliable for gateway caches - Impractical* * (sort of)
  • 10. Cache invalidation in practice Two main problems for cache invalidation arise from pragmatism and trade-offs in resource granularity and identification: • The "Composite Problem" • The "Split-resource Problem"
  • 11. Composite Problem Perfect World: <collection> <item rel="item" href="/items/123" /> <item rel="item" href="/items/asdf" /> <item rel="item" href="/items/foobar" /> </collection> Real World: <collection> <item rel="item" href="/items/123"> <title>Item 123</title> <content>Content for item 123 - an example of embedded state</content> </item> <item rel="item" href="/items/asdf"> <title>Item asdf</title> <content>This state is also embedded</content> </item> <item rel="item" href="/items/foobar"> <title>FooBar</title> <content>Yet more embedded state!! :(</content> </item> </collection>
  • 12. Composite Problem What effect would the following interaction have on the composite collection it belongs to? > PUT /composite-collection/item123 < 200 OK
  • 13. The Split-resource Problem Given /document resource with representations: /document.html /document.xml /document.json When a client does this: PUT /document Then invalidation of each representation is invisible to intermediaries
  • 14. What's the Problem?
  • 15. .. The Solution Beef up the uniform interface: Express these common types of resource dependency as control data using Link header and standard link relations This increases: - Self-descriptiveness of messages - Visibility "Link Header-based Invalidation of Caches" (LHIC)
  • 16. LHIC-I Express dependency in response to an invalidating request > PUT /composite-collection/item123 < 200 OK < Link: </composite-collection>; < rel="http://example.org/rels/dependant"
  • 17. LHIC-II Express dependencies in initial cacheable responses > GET /document.html < 200 OK < Link: </document>; < rel="http://example.org/rels/dependsOn" > GET /document.xml < 200 OK < Link: </document>; < rel="http://example.org/rels/dependsOn" > GET /document.json < 200 OK < Link: </document>; < rel="http://example.org/rels/dependsOn" > PUT /document < 200 OK
  • 18. Comparison LHIC-I + More dynamic control of invalidation - DoS risk - Invalidation does not cascade LHIC-II + No DoS risk + Cascading invalidation - Complexity
  • 19. Conclusion LHIC injects lost visibility. Resulting mechanism: + Very efficient + Ensures freshness + Easily managed + Leverages existing specs - Only for gateway caching + Combine Invalidation (gateway) & Validation (client)
  • 20. Considerations Resource state altered outside of uniform interface - Don't do that - Reintroduce expiration and validation Peering - Further research Size limits for HTTP headers