The first commit refactors the DNS resolver into a separate class from the service.
The second commit optimizes the resolver's performance by implementing a fixed size thread pool of 10 workers. Each worker establishes a TCP connection to Google’s Public DNS in order to resolve a single DNS query.
On average, there's a ~80% performance improvement, especially for the range of 4-10 QPS.
Previously the resolver could not handle more than 5 QPS.
For the lower QPS range (1-2) the resolver performs worse, but more reliably, than before.
This change is