henhen
henhen

Reputation: 1203

Load Balancers, server task, splitting servers and AWS instance

I am trying to learn how load balancing and servers work (both cloud servers or regular pool servers). From my understanding, load balancers redirect requests from users to servers with the least amount of stress/connections, so that the webpages may load quickly no matter how many users are making the same request. The part I am confused about is the TASK each server does. From what I am seeing online from diagrams and such, it seems like there are multiple servers that do different tasks such as sending a view file (html) or sending static content or a server for the database (MySQL). But I also hear that doing this can be bad since splitting your servers can make things complicated by for example by having different DNS's that each do different things. So I guess what I need to be clarified is, do servers just do all the things it needs to do in ONE server, so I mean if a request is asking for a view file, it goes to the same server as the one that handles requests for static images or a post request or get request etc.

And regarding AWS instances, does that just mean each instance is just another copy of the "setup" you have. Meaning one instance has server A with Database Server A, but another instance is just another copy of it, so the second instance will also have Server A with Database Server A?

                            Server A (for doing everything such as sending 
                                      view file, get requests static 
                                      assets etc.)
                            Server B (For database MySQL)
                           /
user ---> DNS ---> load b. -  Server A (for doing everything such as 
                                        sending view file, get requests 
                                        static assets etc.)
                              Server B (For database MySQL)
                           \ 
                              Server A (for doing everything such as 
                                        sending view file, get requests 
                                        static assets etc.)
                              Server B (For database MySQL)

So basically what I am trying to ask is, do all servers the load balancers redirect to have the same task or do the load balancers send them to different separate servers with different task. If the latter, how does it know when to send it to the server for lets say serving static files and what if there were many request to this server, how would the load balancer handle that?

And is each group of servers I have in my little diagram (server A and Server B) is that what an AWS instance is kind of like?

Upvotes: 0

Views: 528

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269350

The answer is that the servers do whatever you configure them to do.

Sometimes people design their system so that every server can respond to any request, and sometimes they have separate servers for separate tasks (eg some servers handling mobile requests, some handling authentication requests, others handling web requests). In AWS terminology, these different groups of servers would be separate Target Groups and the Application Load Balancer would be configured to send requests to different Target Groups based upon the content of the URL.

On thing, however... Database servers are never placed behind a load balancer like you have shown above. Only the application servers have communication with a database server. This makes a 3-tier architecture:

Load Balancer -> Application Servers -> Database

Normal practice is to put the database on a separate server (or a cluster of servers) so that they are independent to the application. This allows the application to scale by adding/removing app servers, without impacting the database.

It is also worthwhile offloading static content to Amazon S3. This can be as simple as changing the URL in an <img src=...> tag. This improves bandwidth because Amazon S3 is huge and it means there is less traffic going through the Application Servers. This improves scaling of the application.

Upvotes: 2

Related Questions