I'm miss understanding what is the different between Layer7 or Layer4 applying load balancing. Is one of them better ? How I can decide which more applicative to my system ?
Thanks in advance ...
I'm miss understanding what is the different between Layer7 or Layer4 applying load balancing. Is one of them better ? How I can decide which more applicative to my system ?
Thanks in advance ...
I guess this could be a very strong discussion and anyway it's not related to programming but...
The difference between them is where (which OSI layer) you do the balancing. In my opinion you should never do balancing only on layer 7 (then you should always use the layer 4).
Why? Layer 7 load balancing is good because you do not need any special hardware for it, it's done at application level, but you pay this with many many other drawbacks:
Why they are good? They could be a quick, easy, dirty solution to patch a non scalable application (for layer 4 balancing your ASP.NET application should be scalable by itself). They could be a temporary solution to a contingent problem, not The Solution. In the real world the layer 4 load balancing is preferred (and sometimes mixed with layer 7 balancing, Google for example uses a first level round robin dns load balancing).
Read this very good article about load balancing: http://1wt.eu/articles/2006_lb/index.html
Something I found funny, here (about advantages of layer 7 load balancing) they say:
While the use cases are still fairly limited, this functionality of layer 7 load balancing does open up many possibilities for future use. As this technology evolves, we will gain the ability to balance additional types of traffic more intelligently.
If use cases (of these advantages) are "still fairly limited" and we have to wait that "as this technology evolves" then I do not see any reason to base NOW any load balancing solution only on layer 7 (moreover it's something really easy to add in any moment in the future).
Layer 4 load balancers act upon data found in network and transport layer protocols (IP, TCP, FTP, UDP).
Layer 7 load balancers distribute requests based upon data found in application layer protocols such as HTTP. It can also distribute requests based on specific data like HTTP headers, cookies, or data within the specific parameter of http.
So layer 4 load balancer is tcp load balancer, whereas layer 7 load balancer is http load balancer.
Feature |
Layer 7 |
Layer 4 |
---|---|---|
Protocol | Application Layer (HTTP/s) | Network Layer (TCP/IP) |
Another name | Software Load Balancers | Hardware Load Balancers |
Flexibility | More flexible | Less flexible |
Cost | cost- effective | Very Costly |
Managed By | App developer generally | Sys Admin, Networking Emp |
Deployment | Very easy | Hard compare to L7 |