Load balancing with DNS is, as it may sound, complicated. There are many things that have to go correctly for DNS Load balancing to work, amongst other factors, which play part into the servers that get millions, if not billions of requests per minute.
However, a very interesting experiment comes up with bGuard and its load-balancing technique, which didn't really exist whatsoever, up until the 1.41 update.
Before 1.41, bGuard used to take socket requests synchronously, despite bGuard using event dispatchers which are async by nature, this was because bguard did NOT utilize async features which were available on node, which even if used, would NOT work asynchronously, mainly due to issues with usage on the dgram module, and how funtions were defined and used within the event dispatcher.
This means that theoretically, since requests take anywhere from ~120-300ms to resolve, and ~40-90ms to recieve, we could theoretically handle 400 requests per second, which is not much, but should be enough to handle a small amount of users.
However, due to the recent DDOS attacks on bGuard, which totalled to ~4000 requests per second, we needed to increase the efficiency of the request processing and the request resolving.
This is where process spawning and distributing comes in.
Thankfully, nodejs (and many other high-level programming languages) support process spawning, and multithreading.
Basically, multithreading and process spawning helps us by allowing bGuard to create child processes (another script) to handle a function call, whilst letting the server handle more, this throws out the syncronous approach to bGuard, and theoretically, allows us to process infinite requests, given, they are under the PID limit.
The server structure for bGuard changed, from being a simple UDP4 / WS / Express server, to having a Database interface, with 1.41, the server interface changed, as the syncronous process caller changed to Async, whilst also maintaining request priority and requestor responses.
To Summarize, bGuard can now handle a decent amount of requests, more than what a nodejs server should realistically be able to handle, which is quite impressive. using traceroute (SRV Records) to test the Load-Balancing on bGuard, we get impressive results:
Alonside this, the server has increased stability, which makes it quite impressive to even be able to run, overall, load balancing bGuard was a very daunting task, yet, a very fun one to poke at.