Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18
... eg. how is my bank website handled when the load is too much for 1 server? I assume that they add more, but then how does it work? How ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Mar 2013
    Posts
    338

    How to do production websites (load balancing)?


    ... eg. how is my bank website handled when the load is too much for 1 server? I assume that they add more, but then how does it work? How do they make sure that, for example, if I take money out of my account, that that data gets propagated through to each server handling the site?


    Thanks.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,533
    There are load balancer appliances that will route a request to the next available server. This is a common pattern. Some are simple round-robin balancers (each request goes to the next server in the list), and others are more sophisticated in that they can determine which server has the least load and assign the next process to that one. The Elastic Load Balancers on the Amazon cloud are the round-robin types, as are most others.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    930
    At the larger places I worked we used f5 load balancer's and you can get very sophisticated on handling traffic in or out and based on many other factors.

    https://f5.com/glossary/load-balancer

    Last gig was for a medium size place on a budget and with used a Cloud based balancer that worked quite well.

    Load Balancing as a Service - Rackspace Cloud Load Balancers
    A lion does not lose sleep, over the opinion of sheep.

  4. #4
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    889
    Here's something you may find of interest: Reddit: Lessons Learned from Mistakes Made Scaling to 1 Billion Pageviews a*Month - High Scalability -

    Well worth reading if you want to know how modern websites are designed.

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,533
    Quote Originally Posted by docbop View Post
    At the larger places I worked we used f5 load balancer's and you can get very sophisticated on handling traffic in or out and based on many other factors.

    https://f5.com/glossary/load-balancer

    Last gig was for a medium size place on a budget and with used a Cloud based balancer that worked quite well.

    Load Balancing as a Service - Rackspace Cloud Load Balancers
    Yeah. We used F5 gear also - it is still a round-robin type of LB, at least by default.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Linux User
    Join Date
    Mar 2013
    Posts
    338
    Yes, so how is the data replicated from one server to another?

    How does the load balancer know if a particular server has data which isn't fresh? (if it does)

  7. #7
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,534
    If you are talking about database data then typically database replication is used. Here is a howto for mysql however, a properly specified and configured database server can handle a surprising number of connections with ease.

    If you are talking about web pages then they are deployed, either manually or with an automated process. We had a three web server set up that we uploaded the changes to server A (not into the live directories) and an incron script took care of the rest.
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  8. #8
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    930
    Quote Originally Posted by resetreset View Post
    Yes, so how is the data replicated from one server to another?

    How does the load balancer know if a particular server has data which isn't fresh? (if it does)
    Load balancers only juggle which web server a client is sent to nothing else. It's up to you to design a scheme for keeping all the servers data, web pages, and etc insync with each other. MySQL database replication is drop dead simple to setup as for the rest rsync is a good tool. On last system I worked on we had a handful of web servers and I used GIT to keep the content insync between servers.
    A lion does not lose sleep, over the opinion of sheep.

  9. #9
    Linux User
    Join Date
    Mar 2013
    Posts
    338
    I don't understand. Say for an ecommerce site, there's 1 watch left or whatever, and someone places an order for it - server 1 is busy taking the card details, and now a second customer comes in, and sees that there's still one watch left, cause server 1 hasn't yet told server 2 (both under the same load balancer) that the watch has been bought, i.e. inventory is now 0 - how is this handled? Surely there must be some way for the load balancer and all servers under it to communicate (except for simple CPU load)?

  10. #10
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,387
    From your example:
    Ensuring that only one watch can actually be bought is not a task for a loadbalancer, and also not the shop application on the two servers.
    It is a task for the database.
    It will probably involve an atomic transaction and a write lock on a table.
    You must always face the curtain with a bow.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •