Closed ghost closed 2 years ago
Good catch.
Maybe we can send a pull request to ewma in order to make the number of warmup samples tunable?
Pull requests for new features will be rejected, so we recommend forking the repository and making changes in your fork for your use case.
Ah :( Ok...
Alternatively, we may want to try SimpleEWMA
.
Maybe it is not that bad for LBEstimator
:
initialRtt
.
https://github.com/DNSCrypt/dnscrypt-proxy/blob/9373cc71625456f9012d0186b8393d208bca4666/dnscrypt-proxy/proxy.go#L235-L236And assuming it's already warmed up, would not too bad.
You can simulate and watch it using EWMA_cmp.xlsx. I created it while creating my own EWMA variant, which has a adjusting decay during the warmup. It works by Excel formulas. N stands for warmup sample size. Calculate Now (F9)
or entering the value of cell A2 can refresh the sample values in column D and other results.
@lifenjoiner
Your variant works well.
@livingentity Yes. I mean as we did those 2 things, the EWMA quality shouldn't go too bad, I guess. You can see the simulation from my previous screenshot. It is the column G comparing to the real average in column I. On the other hand, even we get the exact real average, it would not 100% predict a server's quality in a next query. :p If we can improve it, it'd be better!
Logging the real rtt
related changes, if possible, may give a more detailed proof.
Clipping or trimming extreme values should be an improvement, as well as lowering α.
The EWMA implementation used has a warmup phase making it return 0 for the first 10 queries.
Unless I've overseen something and this is compensated somewhere, this means that the LBEstimator is initially only seeing 0 RTTs, which is very counterproductive. Currently it needs 18 queries on average to get a meaningful answer for one server. However as only the first 2 servers are queried, one of the fastest ones now becomes the slowest, because the rest is still 0. So the intial good order would be scrambled and (if it was roughly correct) be brought back only after e.g. 180 queries on average assuming 10 live servers.
So in short it's all screwed up.
Any thoughts on how to solve this? Forking EWMA and set WARMUP_SAMPLES=1?