Topics


Blogs


Forums


Samples


Media


Labs


Resources

 




DevCentral > Weblogs > Lori MacVittie - Two Different Socks
 2.5 bad ways to implement a server load balancing architecture
posted on Friday, October 24, 2008 7:55 AM

I'm in a bit of mood after reading a Javaworld article on server load balancing that presents some fairly poor ideas on architectural implementations. It's not the concepts that are necessarily wrong; they will work. It's the architectures offered as a method of load balancing made me do a double-take and say "What?" 

I started reading this article because it was part 2 of a series on load balancing and this installment focused on application layer load balancing. You know, layer 7 load balancing. Something we at F5 just might know a thing or two about. But you never know where and from whom you'll learn something new, so I was eager to dive in and learn something.

I learned something alright. I learned a couple of bad ways to implement a server load balancing architecture.

TWO LOAD BALANCERS?

The first indication I wasn't going to be pleased with these suggestions came with the description of a "popular" load-balancing architecture that included two load balancers: one for the transport layer (layer 4) and another for the application layer (layer 7).

quote-left In contrast to low-level load balancing solutions, application-level server load balancing operates with application knowledge. One popular load-balancing architecture, shown in Figure 1, includes both an application-level load balancer and a transport-level load balancer.

Even the most rudimentary, entry level load balancers on the market today - software and hardware, free and commercial - can handle both transport and application layer load balancing. There is absolutely no need to deploy two separate load balancers to handle two different layers in the stack. This is a poor architecture introducing unnecessary management and architectural complexity as well as additional points of failure into the network architecture. It's bad for performance because it introduces additional hops and points of inspection through which application messages must flow. To give the author credit he does recognize this and offers up a second option to counter the negative impact of the "additional network hops."

quote-left One way to avoid additional network hops is to make use of the HTTP redirect directive. With the help of the redirect directive, the server reroutes a client to another location. Instead of returning the requested object, the server returns a redirect response such as 303.

I found it interesting that the author cited an HTTP response code of 303, which is rarely returned in conjunction with redirects. More often a 302 is used. But it is valid, if not a bit odd.

That's not the real problem with this one, anyway. The author claims "The HTTP redirect approach has two weaknesses." That's true, it has two weaknesses - and a few more as well. He correctly identifies that this approach does nothing for availability and exposes the infrastructure, which is a security risk. But he fails to mention that using HTTP redirects introduces additional latency because it requires additional requests that must be made by the client (increasing network traffic), and that it is further incapable of providing any other advanced functionality at the load balancing point because it essentially turns the architecture into a variation of a DSR (direct server return) configuration.

THAT"S ONLY 2 BAD WAYS, WHERE'S THE .5?

The half bad way comes from the fact that the solutions are presented as a Java based solution. They will work in the sense that they do what the author says they'll do, but they won't scale.

Consider this: the reason you're implementing load balancing is to scale, because one server can't handle the load. A solution that involves putting a single server - with the same limitations on connections and session tables - in front of two servers with essentially the twice the capacity of the load balancer gains you nothing. The single server may be able to handle 1.5 times (if you're lucky) what the servers serving applications may be capable of due to the fact that the burden of processing application requests has been offloaded to the application servers, but you're still limited in the number of concurrent users and connections you can handle because it's limited by the platform on which you are deploying the solution.

An application server acting as a cluster controller or load balancer simply doesn't scale as well as a purpose-built load balancing solution because it isn't optimized to be a load balancer and its resource management is limited to that of a typical application server. That's true whether you're using a software solution like Apache mod_proxy_balancer or hardware solution.

So if you're implementing this type of a solution to scale an application, you aren't going to see the benefits you think you are, and in fact you may see a degradation of performance due to the introduction of additional hops, additional processing, and poorly designed network architectures.

I'm all for load balancing, obviously, but I'm also all for doing it the right way. And these solutions are just not the right way to implement a load balancing solution unless you're trying to learn the concepts involved or are in a computer science class in college. 

If you're going to do something, do it right. And doing it right means taking into consideration the goals of the solution you're trying to implement. The goals of a load balancing solution are to provide availability and scale, neither of which the solutions presented in this article will truly achieve.

Follow me on Twitter View Lori's profile on SlideShare AddThis Feed Button Bookmark and Share



 
      

Feedback


10/29/2008 12:18 AM
Gravatar
Using a dedicated (transport level) load balancer together with Apache (mod_proxy, …) and a servlet container such as Tomcat or Jetty is uncommon? I do not see this. In the world of java this architecture is a popular solution. Please remember you found this article on JavaWorld which is focussed on Java solutions.

I agree with you that additional network nodes should be avoided. The article also discusses different solutions to do this. It also mentions that commercial solutions exist (for instance products of F5, the company you work for). However this article is focussed on open source solutions. This is the reason why commercial solutions such as F5 has not been mentioned or compared.

You mention that 303 is rarely used, that’s right. Hey, this is an example. It do not show productive code. May be I should have been used 302 in the example. But, doest it really matter?

If you are running architectures such as IPVS/Apache/Tomcat, apache will only be used to forward the request to the target tomcat based on Level-7. In this case the potential scalability bottleneck is transport-level load balancer (IPVS), not the application server.

You forget to mention that the article also show solutions which do not require a two stage intermediate load balancer architecture. For instance with client-side controlled load balancing, the load balancing will be done within the client process. You do not have to install or to buy a load balancer which acts in the middle (a bad case for F5, nothing to sell).

Do you have the impression that the article focuses the intermediate two stage load balancer solution as the preferred load balancing solution? In my conclusion I discusses that the client-side load balancing is a very powerful solution (unfortunately with some restrictions). I also mentioned that in many cases running an infrastructure based on a transport-level load balancer together with solutions for distributed caching/session management is very powerful. The intermediate two stage load balancer solution is just one of many solutions.

Gregor
Gregor

2/17/2009 3:41 AM
Gravatar True or False: Application acceleration solutions teach developers to write inefficient code
Lori MacVittie
 Leave Feedback
Title  
Name  
Email
Url
Comments   
Please add 2 and 2 and type the answer here: