Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Bulk Endpoint Caching with Casper

3,049 views

Published on

This short deck explains how Casper (https://github.com/Yelp/casper) proxies and handles our internal bulk endpoints for greater cacheability. See the full blogpost at https://engineeringblog.yelp.com/2018/03/caching-internal-service-calls-at-yelp.html

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Bulk Endpoint Caching with Casper

  1. 1. Bulk Endpoint Caching
  2. 2. Request #1: initial request
  3. 3. Client Casper Server GET ids=1,2,3 Datastore Initial request (cache miss)
  4. 4. Client Casper Server GET ids=1,2,3 Datastore Cache miss! Initial request (cache miss)
  5. 5. Client Casper Server GET ids=1,2,3 GET ids=1,2,3 Datastore Initial request (cache miss)
  6. 6. Client Casper Server GET ids=1,2,3 GET ids=1,2,3 [{"id":1…},{"id":2…},{"id":3…}] Datastore Initial request (cache miss)
  7. 7. Client Casper Server GET ids=1,2,3 GET ids=1,2,3 [{"id":1…},{"id":2…},{"id":3…}] Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Cache write Initial request (cache miss)
  8. 8. Client Casper Server GET ids=1,2,3 GET ids=1,2,3 [{"id":1…},{"id":2…},{"id":3…}][{"id":1…},{"id":2…},{"id":3…}] Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Initial request (cache miss)
  9. 9. Request #2: shuffled IDs
  10. 10. Client Casper Server GET ids=3,2,1 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Shuffled IDs (cache hit)
  11. 11. Client Casper Server GET ids=3,2,1 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Cache HIT! Shuffled IDs (cache hit)
  12. 12. Client Casper Server GET ids=3,2,1 [{"id":1…},{"id":2…},{"id":3…}] Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Shuffled IDs (cache hit)
  13. 13. Request #3: subset of IDs
  14. 14. Client Casper Server GET ids=2 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Subset of IDs (cache hit)
  15. 15. Client Casper Server GET ids=2 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Cache HIT! Subset of IDs (cache hit)
  16. 16. Client Casper Server GET ids=2 [{"id":2…}] Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Subset of IDs (cache hit)
  17. 17. Request #4: superset of IDs
  18. 18. Client Casper Server GET ids=1,2,3,4 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Superset of IDs (partial hit/miss)
  19. 19. Client Casper Server GET ids=1,2,3,4 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} Partial miss! Superset of IDs (partial hit/miss)
  20. 20. Client Casper Server GET ids=1,2,3,4 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} GET ids=4 Superset of IDs (partial hit/miss)
  21. 21. Client Casper Server GET ids=1,2,3,4 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} GET ids=4 [{"id":4…}] Superset of IDs (partial hit/miss)
  22. 22. Client Casper Server GET ids=1,2,3,4 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} 4 ⇒ {"id":4…} GET ids=4 [{"id":4…}]Cache write Superset of IDs (partial hit/miss)
  23. 23. Client Casper Server GET ids=1,2,3,4 Datastore 1 ⇒ {"id":1…} 2 ⇒ {"id":2…} 3 ⇒ {"id":3…} 4 ⇒ {"id":4…} GET ids=4 [{"id":4…}] [{"id":1…},{"id":2…},{"id":3…},{"id":4…}] Superset of IDs (partial hit/miss)

×