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?