cristalhq/hedgedhttp

Determining the effectiveness of hedging

Closed this issue · 3 comments

Hey @cristaloleg

Is there a way to determine how many hedged requests actually "won" vs the original request, with the stats?

Hm, interesting question. The simplest answer is to look at the metrics & compare results for original vs hedged requests. Again as per #18 and custom http.RoundTripper witch collects those stats.

The only thing is that it will report global stats, not per every request (that's how I imagine it's behaviour). Adding no-op ?req_id=XXX to every request can help with request grouping and as a result true metric for each request.

I can try to make a PoC this week unless you're eager ;)

OK cool, thanks!

I'll be back on this topic next week, and I might put together a PR unless you get to it first 🙂
It doesn't necessarily need to be per-request; I just want to be able answer the question "of all the hedged requests we made, what % of them actually helped?".

I did a quick prototype #46 (so no tests) but looks like that's what we want.

If we got a response/result from waitResult and it's successful (resp is not nil) than we can bump a metric for the original (index 0) or hedged (index non-zero).

I will try to cover this with a test tomorrow-ish. Review and thoughts are welcome.

CC: @storozhukBM