What TAO keeps in the cache and in MySQL

video locked
Enroll to watch

8 mins

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

TAO's cache uses the memory layout of memcache. A cache of 64 GB is cut into slabs by the size of the objects, with most of the memory, 32 GB, kept for small objects. Each slab behaves like an LRU cache.

Counts are stored separately, in count caches. An entry holds a source, a type and the count in a single 32 bit integer.

Negative entries are stored too. A count of zero for the likes on a post answers the query for the people who liked it, and the database is not queried. Empty arrays are no longer stored, which saved 20% of the cache space: three thousand servers became two thousand four hundred.

In MySQL, objects are stored in a single table of a 64 bit ID and the object data. Edges are stored in one table:

  1. The source, the type and the timestamp sit in one column.
  2. That column is the only index.
  3. All the likes Pradeep made in the last three days are sorted together, and a single query fetches them.