About DNS polling

We are currently using DNS polling for four web servers.

The problem we are facing is this: when the user refreshes, he can go to other web servers. It is very bad when the user is already logged in. As we are using session to remember login status but when updating on other web servers the session is lost.

Thus, the best solution should be to force the user to stay on the same web server when they update. Is there a way out?

0


a source to share


6 answers


Ok, I assume you mean "Round Robin DNS". It is good that you are describing a very common problem and there is no "right" solution for that, as the possible answers depend on many variables: are you trying to provide automatic failover or just load balancing? Are you willing to spend time and / or money on a load balancer? What technologies are you using? Java EE? PHP? Apache? IIS?



Having said that, if you are only after load balancing and failover is not a problem, you can use different names for each server (www1, www2, www3, etc.) and redirect them from your "main" web -server (www) on first access. It's simple (and oversimplified) but practical in a few settings.

+2


a source


Can web servers use a shared database server to store session information?



+1


a source


I know that some hardware load balancers will create a sticky connection between the user and the server to avoid this kind of problem.

+1


a source


You have several options.

  • You can store sessions in a keystore: value, i.e. memcached (my personal favorite)
  • You can store sessions in a database
  • You can set up back-proxy loadbalancers like in DNS and your servers in the back. Then set it so that all requests from the same IP addresses go to the same servers, no matter which one occurs. HAProxy calls this option balance source

    . Beware: if the number of node changes, sessions may be lost. To avoid this, you can use functions cookie

    or url_param

    .

See HAProxy documentation . It's really worth reading.

+1


a source


Are all four web servers on the same site or network, or are they distributed?

If the former, you can include the server ID somewhere in the HTTP response so that the reverse proxy in front of the real servers can figure out which server is responsible for the session.

0


a source


A DNS server that can respond based on the location of the client can solve this problem. An example would be PowerDNS with Geographic Information Module or GeoIPdns. You will need to make sure that the sets of IP addresses do not overlap, so the client always gets the same response.

It wouldn't provide any kind of failure on its own.

0


a source







All Articles