-
Notifications
You must be signed in to change notification settings - Fork 25
support backup request on client side #84
Comments
Your first idea is to broadcast read requests to all the replicas in a group. Apparently, this is unacceptable. It will result in 3 times read throughput than previous. The overall latency will certainly increase by the higher load. Actually, the most difficult part of "backup request" is to make overhead as minimum as possible. Tripling or doubling the workload should not be our option. One scheme ("hedged request") is to defer the secondary request for a short period, which is often the desired p999 latency, 15ms eg. If the first request can't get replied within the period, the second request is sent. Theoretically, this solution requires only 0.1% additional load, which is cost-effective for our latency-sensitive users. This scheme is easy to implement, but one problem is the user has to learn how to appropriately set the "period". In BRPC's implementation of hedged request, it's an option called For more readings, I copied here the paragraphs related to "hedged request" in "The tail at scale". Take a look. |
There are two ways to implement backup request. Hedged requests A client first sends one request to the replica believed to be the most appropriate, but then falls back on sending a secondary request after the first request has been outstanding for more than the 95th-percentile(or 99th-percentline, etc) expected latency. The client cancels remaining outstanding requests once the first result is received. This approach limits the additional load to approximately 5%(1%) while substantially shortening the latency tail. This approach limits the additional load to approximately 5%(1%) while substantially shortening the latency tail. This approach limits the benefits to only a small fraction of requests(the tail of the latency distribution). Tied requests the client send the request to two different servers, each tagged with the identity of the other server (“tied”). When a request begins execution, it sends a cancellation message to its counterpart. The corre- sponding request, if still enqueued in the other server, can be aborted imme- diately or deprioritized substantially. There is another variation in which the request is sent to one server and forwarded to replicas only if the ini- tial server does not have it in its cache and uses cross-server cancellations. This approach limits the benefits to not only the tail of the latency, but also median latency distribution. But it result in higher network load. |
My first choice is "hedged request". Because it's apparently simpler. We can leave optimization later after the initial version. To dig deeper into the final design, there're still several problems remain:
Since we have 2 secondaries, we can choose randomly one in 50:50 for the second request. Another question is, how to design the API for configuring the period waiting for the secondary request (call it One way I suggest is to add an argument in |
It is more effective to send to one sencondary randomly than send to all of the secondaries. Because according to performance test, send to all of the two secondaries will increase p95. Because send to all secondaries will increase server load a lot. |
performance test set/get operation:
Multi-get/Batch-Set operation:
|
The proposal resides in apache/incubator-pegasus#251.
一、背景
Backup request功能可以优化业务在服务抖动时读延迟的长尾问题,适合对一致性要求低的用户。
二、设计
备注:
The text was updated successfully, but these errors were encountered: