retrystorm · Learn · Interview practice · Glossary · Components

Home › Interview practice › Publish and Refresh

Publish and Refresh

Make sure writers always see the posts they just published, without paying for strong reads nobody needs.

Inkwell's posts live in a key-value store. Writers publish and edit posts all day, and many of them refresh straight away to check. Every few minutes one of them writes in: the post they just published isn't there. A second later, it is.

What it does

  • Write: a writer publishes or edits a post.
  • Read: someone opens a post. Often it's the writer who just changed it.

Workload

A steady 20 000 rps, 95% reads / 5% writes, for 20 seconds, against 100 000 posts. Popular posts get most of the reads and most of the edits.

How to build it

The app tier is fixed: six xlarge replicas behind a load balancer. You choose the key-value store's partitions (small, each 5 000 read units and 1 000 write units a second) and its consistency:

ConsistencyEach read costsReads see
eventual1 read unitany copy, possibly a moment behind
strong2 read unitsthe latest write
strong_after_write2 units for keys written in the last second, 1 for the restthe latest write when it's recent
  1. Build client, load balancer, app server, KV store, and run it. Look at Read your writes in the results.
  2. Fix it for writers, then look at what it cost.

Part of Chapter 28: Consistency.

About · Contact · Privacy · Terms of use