A graph cache in front of MySQL

video locked
Enroll to watch

5 mins

Chapters
About
Discussion0
Notes
Be the first to start a conversation!

TAO is a cache tier in front of a database tier.

Client requests are routed to the appropriate cache server, and the cache tier can manage any TAO request. The database tier handles multiple shards. The data has to be stored somewhere, and the database is MySQL, which Facebook has used for a long time.

A request that the cache cannot serve moves on:

  1. A cache miss. The read goes to the next layer, which is another cache or the database.
  2. A write. It goes to the database, because a write needs high consistency.

The cache contains commonly queried objects, the likes on each object, and how many people have liked it. Its replacement policy is least recently used, the same as memcached.

The cache also gives smart responses. A cached count of zero answers a later get with the same parameters with an empty set. Brad Pitt has zero recent posts, so a get for his recent posts returns nothing.

This reduces latency for a common query pattern, where get and count queries come together.