Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


load balancing a website/system
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

load balancing a website/system

So, been meaning to ask and clarify this for a while.

Say you own a very popular website (example.com). Or maybe this website is a web system that acts as a api for some app(s). Anyway so the question is, if you are expected to get more traffic than a server can handle for a website or such system, how would you go about setting up a load balancer?

Are there anyway to host the same domain/website at multiple servers and and do something tricky at the DNS level to direct traffic to the different server (load balancing). If so, how would you go about it, any DNS hosts like cloudflare offer this, if so how would you set this up? Also, how would you define logic, about who gets directed where/when?

Next, on this sort of approach, how would SSL work? Multiple IP addresses for same domain, how is that going to work?

Lastly. If the said system relies on a database, let's say its an api for something (so let's also say the data changes often). How would you go about keeping this dB synced? I suppose this might be a programming question, I know few ways, but if anyone know some good effective ways, I'm all ears :)

Thanks in advance :)

Comments

  • BruceBruce Member

    cluster of webservers (frontend), connecting to a database server (backend). the loadbalancing is done by changing the IP served to the session (via DNS). there's many methods used, depending on the scale. this is a simple setup

    would like to know how geolocated services are done. never done that

  • If you want to avoid the whole backend database drama then you can do this easier with reverse caches. Deploy caches around and have them origin from the primary webserver.

    If the webserver fails, you can also set the caches to serve stale content.

    For geolocated services, there are a variety ways to do it - anycast being the most simple way.

  • I am going to work from the bottom up. Lets say you are using a wordpress site. And you need both wordpresses to use the same database you can make one of the wordpress servers the database primary or have a central database server that does not host the wordpress php files or assets. In the wordpress config file you will normally see the database server is localhost. Insteed you would want to use use the fqdn/ip of the database server.

    When it comes to handling the traffic coming in from the web dns load balancing is one way its not the best method but most modern browsers and clients will try the other dns records if the first one they try is down. Most of the time it will pick the a random record to start with. Now when you have the problem that your talking about with SSL many services will have the router or a physical load balacner. lets say you have a router it will know traffic coming in on port 80 should go to one of the following servers. Both of those servers can listen for traffic on that ip address since the router will talk to them by the physical port or mac address again this is a little complicated but the point is the servers and the client see 1 ip address but it is owned by many nodes.

    to answer your questions on how more then one server with different ip addresses can share the same cert i will direct you to stackoverflow. http://stackoverflow.com/questions/909453/single-ssl-cert-on-multiple-servers

    Thanked by 1Bruce
  • multiple dns entries doesnt hand out random ips - it is a round robin - it hands out record 1 to first request, record 2 to second request and so on, when it reaches end of records it starts again. this is load balancing based on averages of big numbers but can certainly still allow particular servers to get worked harder than others at various times. nice and easy to setup. if its a really busy website you could use a load balancer like a f5 or barracuda or a reverse proxy server. the DB can complicate things. Use a single DB or your app/db needs to be able to merge records from multiple DBs which can get real messy. the SSL thing is not an issue - easy to do.

Sign In or Register to comment.