tags:

views:

332

answers:

2

We're adding a second web server for redundancy and load sharing purposes. All connections are mandated to be SSL, and adding a dedicated appliance is not possible at this moment.

I'd like to use round robin DNS, where both servers answer to the same domain using different IPs (we have a wildcard SSL certificate, so that's OK). I can get the DNS to return in random/round robin order no problem.

Is this a bad setup when using SSL?

Our user pattern is consistent -- users will consistently be utilizing the web app for 8-10 hours. We want each page view to be as fast as possible, and my concern is users could constantly flip between the servers, potentially negating any SSL handshake caching/keep alive.

Thanks!

A: 

Firstly, SSL has the ability to resume an earlier session, so flipping between servers will cost you a few hundred ms per request (longer if several clients are accessing the site simultaneously, since this is CPU time we're talking about).

Whether the clients will actually flip depends, though - DNS "load balancing" is fiddly business:

  • if many of your users are using the same recursive nameservers, they'll get the same "first IP" hence no load balancing
  • if the DNS record has a high TTL (several hours), caching nameservers will store a particular permutation of IP addresses until they expire (good so long as your users aren't all using the same recursive nameservers)
  • if your users have multiple recursive nameservers configured, they may flip if each nameserver has a different "first IP" (bad)
  • if you have no mechanism for removing "bad" records, and a low TTL, then if one server goes down 50% of your clients will get the "bad" server and have to wait for a timeout before they can see your site

As you can see there are various tradeoffs depending on whether you're more concerned about redundancy/failover or load balancing; DNS isn't really the best tool here - you really need the servers to share an IP using either a reverse proxy, or something like Heartbeat (assuming you're Linux-based).

An aside: if both servers are answering to the same domain then you don't need a wildcard cert, although CAs often charge more if you intend to use a cert on more than one server.

SimonJ
Thanks for the info. It's not our end-all load balance solution certainly. We already had a wilcard cert due to other subdomains being SSLd as well.Thanks!
pytechd
A: 

Don't worry about it. There are multiple levels of DNS caches so user is not going to flip between 2 IPs on every request. The IP will stay the same for hours for each client.

We have an opposite problem. When server goes down, the user still has the bad IP. We set the TTL to 1 minute but very few browsers honor it. Due to this issue, VIP is a much better option than DNS for load-balancing on the same network.

ZZ Coder
re: browsers, you'd have to look at the browsers and their OS to see the problem.In the case of Mozilla, there is some fixed-duration caching by default for 1 minute.https://developer.mozilla.org/En/Mozilla_Networking_Preferences#DNSBut the browsers don't often get access to TTL info:https://bugzilla.mozilla.org/show_bug.cgi?id=151929#c34and also OS-level DNS caching is very common now (I have not spent as much time on the internals of that).
benc