Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

HttpWebRequest keepalive and dns load balancing

$
0
0

Good Afternoon.

One of our primary ecommerce systems consists of an asp.net application which connects to several APIs.  As part of a blue-green deployment stategy,  we would like to use weighted dns load-balancing to route traffic to those apis.  Having set up a weighted dns record set in Amazon's Route 53 with a short ttl, repeated querying using nslookup shows that address switching between the supplied ip addresses. When using HTTPWebRequest to access those apis, if the keepalive flag is set, the presentation layer continues connecting to the same ip address, rather than re-looking the api's ip address up after the TTL for the dns record expires.  

Setting HttpWebRequest.KeepAlive to false results in the desired behaviour (subsequent connections are re-resolved and change to a different endpoint once the dns ttl expires).  However this results in higher CPU usage on the clients and the server (assumedly as a result of the tcp re-negotiation).

Is there a middle ground between the two extremes, where the duration of the keepalive can be specified on either the client or server to force a re-lookup and reconnection after a certain period of time?


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>