2 ms·
I don't think this is a good idea at all. Most importantly, you can't rely on the client for doing load balancing! Load balancing is about making sure that one
by tsimionescu 4y ago
I don't think this is a good idea at all. Most importantly, you can't rely on the client for doing load balancing! Load balancing is about making sure that one user can't affect the service quality for other users. Exposing all backend servers directly to users and asking them to choose which to use is a recipe for denial of service attacks and floods. Not to mention that LBs can help with auto-scaling based on health checks, but you can't rely on client health checks for that, and DNS would be entirely out of the loop.
DNS as used most commonly by far on the internet is a non-authenticated non-encrypted protocol. Everyone with access to the network can see what DNS requests you are making, so putting even more information in them is not great.
Further, DNS is already a single point of failure, but it at least has the advantage of relatively long cache times - so clients who already resolved the IP they need can keep working. Relying on the DNS Server instead of a separate LB seems like it would greatly increase the risk that you'd constantly be updating DNS records (for example, when your service auto-scales, you have to add/remove DNS records now) meaning you'd want very very short caches etc.
Finally, fixed port numbers are a critical part of having a low attack footprint. Even if you convinced browsers to talk to your service on port 30443 automatically, you'd soon discover that many corporate customers can't reach your service, because their network/firewall blocks outbound traffic to unknown ports. Having dynamic port numbers for protocols would be an anti-feature in most cases.
DNS is already doing the most that it should do. Bloating it with even more responsibility should be avoided, not encouraged.