

ℹ️About GitHub Wiki SEE, a search engine enabler for GitHub Wikis as However, ph would be pretty good if you were choosing regular DNS servers, since there are thousands of those and many would be very fast for you (you can easily find 50 fast servers for any location in North-America). What this means is that if you have a relatively large list of random servers from around the world, and you choose the ph strategy, some of your queries will probably end-up using slower servers p2 is probably the best strategy to use. You should notice that only a few servers are very fast for you, with the majority being appreciably slower. If you enable logging and have a look at the dnscrypt-proxy log, you will see the response times of all your servers when the proxy starts. The same is true for all strategies - random servers will move up in the list when they are faster than the server that was just queried. It will compare how fast that server was with a randomly choosen server and if that random server is faster, the random server will move up. The default strategy is p2 so dnscrypt-proxy will pick one of the two fastest servers. This setting is a string, so you use lb_strategy = 'p2' in the configuration file. random (just pick any random server from the list).ph (randomly choose between the top fastest half of all servers).

p2 (randomly choose between the top 2 fastest servers).first (always pick the fastest server in the list).The 4 possible values of the lb_strategy parameter are: The server is choosen randomly inside that set. You have a choice of 4 different ranges/sets from which to choose the server that will next be queried. The load balancing is done using that list. So, the servers are sorted from quickest to slowest. Since response times vary appreciably even for the same server, especially as DNS servers need to query other servers to resolve domains when they are not in the cache, the servers at the top of the list might move around as time goes by even if they are close to you. Slow servers will probably never compare favorably with the fast servers and will remain at the bottom of the list. Over time, every server gets compared to all other servers and the list is progressively kept sorted. If the newly adjusted RTT of the resolver that was just used happens to be bigger (slower) than a randomly choosen candidate from the list of all servers, then these entries are swapped. How the servers are sortedĭnscrypt-proxy keeps the list of servers sorted at all times.Įach time a query is made to a server, the time it takes is used to adjust how fast dnscrypt-proxy thinks that the server is, using an exponentially weighted moving average. This list is then sorted from fastest to slowest resolver. It calculates an initial RTT (Round-Trip Time) estimation for each resolver (for DoH servers, two initial test queries are made). Each time the list of servers is retrieved (every refresh_delay hours).Each time the server certificates (for DNSCrypt servers) are retrieved/validated (every cert_refresh_delay minutes, 60 minutes minimum).

A server will be choosen randomly among the N fastest servers in your list of servers (or if you are not specifically choosing servers with the server_names parameter, among the N fastest servers from all servers that match your requirements.) How The List Of Servers Is Populated The size of that set is what you can choose in the configuration file with the lb_strategy parameter. It will send consecutive DNS queries to different DNS servers randomly choosen from a sorted (fastest to slowest) set of a choosen size. Dnscrypt-proxy comes with a load balancing algorithm.
