Mobile app version of vmapp.org
Login or Join
Murphy175

: Http keep-alive with multiple A/AAAA records I'm trying to estimate the performance impact of publishing several IP-addresses for a given web-site hostname. Do browsers choose addresses in a random

@Murphy175

Posted in: #Browsers #Dns #Keepalive

I'm trying to estimate the performance impact of publishing several IP-addresses for a given web-site hostname.

Do browsers choose addresses in a random order?

Do they use the same address for all connections, or do they multiplex connections between different addresses at the same time for all requests?

How does this affect keep-alive and post-keep-alive requests? For example, if a user is doing a search, then I'd very much like them to use the same server from there on out, since going to page 2 of the same search query is likely to be much faster on such a hot server than on a cold one. Is there any easy way to ensure something like that, without introducing single-location-only hostnames into www use?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Murphy175

2 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss660

Just to answer the part of the question Stephen Ostermiller didn't:


For example, if a user is doing a search, then I'd very much like them to use the same server from there on out, since going to page 2 of the same search query is likely to be much faster on such a hot server than on a cold one. Is there any easy way to ensure something like that, without introducing single-location-only hostnames into www use?


The obvious solution would be to deploy a load-balancer with persistence in front of your servers, so that it can receive all client requests and forward them to the appropriate server.

There are several ways to implement persistence, including client IP affinity, cookie injection and application cookie learning. For your use case, you could even just base the server choice on the user's search term (presumably found in the URL) alone.

Depending on the method used, it can even be possible to have multiple load balancers with persistence in front of the same server pool, working together, with round-robin DNS used to distribute connections among the load balancers. That way, you can get the best of both worlds: no matter which load balancer the client queries, the request is (preferentially) forwarded to the same back-end server.

10% popularity Vote Up Vote Down


 

@BetL925

Do browsers choose addresses in a random order?


No. The browser makes a request to the operating system to get a single IP address for a host name. When the browser makes the request, the OS may use one of multiple strategies for determining which IP address to use. These include:


Random
Alternating
One that appears to be closest



Do they use the same address for all connections, or do they multiplex connections between different addresses at the same time for all requests?


Most browsers cache the results of a DNS lookup for some time after the request it from the OS. As a result, a single client usually won't multiplex.


How does this affect keep-alive and post-keep-alive requests?


An HTTP keep-alive request is done in the same connection as the previous request. As a result, no DNS lookup is done, it will use the same host. The timeout for keep-alive is usually around 10 seconds, so two queries performed by the same user are unlikely to fall within this window. However, a page request and then a request for images and javascript almost always do.

As for post-keep-alive requests, it depends on how long the browser caches DNS info. It may cache it for several minutes, but it may not.

You probably want to read the wikipedia article about Round-robin DNS. It has some commentary under the "drawbacks" section that you may find helpful: en.wikipedia.org/wiki/Round-robin_DNS

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme