Request hedging for a slow or failed read

video locked
Enroll to watch

10 mins

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

Request hedging sends the same request a second time, so that one slow or failed read does not hold up every caller waiting on it.

Request collapsing takes many requests for the same key into a single one, with one future for the key. If that request fails, everyone gets the failure. A request that takes 10 seconds has wasted ten thousand seconds when a thousand requests were waiting on it.

So requests are collapsed up to a threshold:

  1. Up to 10 users wait on one request.
  2. When the 11th user comes in, another entry is created for the same key with a new future.
  3. The same database gets two calls with the same key, and either response is accepted.

It stays at two calls, because if both fail it is probably a database or a system error.

Zanzibar uses request hedging for calls to Leopard and Spanner, not between its own servers. Every region has at least two replicas, so the second request stays in the region. The threshold of delay changes as per traffic patterns.