Posts Tagged ‘LoadBalancer’

Hardware Loadbalanced VPS Servers

In our Datacenter we have two Diesel Generators, Three Load Balanced Fiber Rings, Dual Power Feeds, Redundant Network and Hardware Nodes.  When you are looking for a High Availability Hosting Solutions, the greatest point of failure is your Single Web Server.  Hardware Loadbalancing offers a way to remove the single point of failure in your application.

To get hardware loadbalancing you must have at least 2 or more VPS or Application Servers.  The Load Balancer will then divide the load between multiple servers, and reduces the actual load on the server.  The hardware device will even take the SSL encryption off the server and carry the SSL encryption load for you.

The different modes available for Load Balancing are: Round Robin, Fastest Response Time, Least Connections, Weighted Round Robin, or a Custom/adaptive Type. A simple explanation would be to say if you run an e-commerce web site; You are like a grocery store, and you want to get a user through the checkout lane the fastest. Right now you only have one checkout lane, and customers are lining up. If you “Load Balance” and open a second checkout lane the user load or wait time is cut in half. If the register runs out of receipt tape (i.e. Server crash), users can switch to the other checkout lane. The end goal, you want ensure the fastest and most reliable service to your customers, so they do not shop elsewhere. I am sure we have all seen a customer leave a store because the line was too long, or the site was not available.

Another benefit of Loadbalancing two servers is being able to take a server off-line to do an upgrade or patch on the system with Zero Downtime to the entire application.  This is a common practice used in patching enterprise applications.

Hardware Loadbalancing of a VPS or Dedicated server is one way to ensure 100% uptime of your enterprise application.  You can also now view your server load balancing configuration and availability in the Client Area, under your Load Balancing Service.

Apache logs and non-transparent load balancers

Typically, in a load balanced environment there are two types of modes that can be configured:

Transparent – Requests come into the load balancer and are transparently routed to the “real” servers behind it. In this setup, the real servers see the request as coming from the client IP address it was originally sent from. This typically requires all real servers to have it’s default gateway set as the load balancer.

Non-Transparent – In non-transparent mode, packets come into the load balancer, are re-written using NAT and then forwarded to the real servers behind it. In this scenario, all connections that come into the real servers appear to be originating from the load balancer.

If you are using any kind of analytics or stats software for your website, a load balancer in non-transparent mode will skew your data as all of your “hits” will appear to be coming from the same IP address (the load balancer). Fortunately, most load balancers have the ability to inject the “X-Fowarded-For” HTTP header into the request that makes it to the real server. This header will contain the original IP address which the request came from. We can use this information for more accurate website reporting.

Because of the flexibility of the Apache web server, we can alter what information goes into our log files. For example, if you wanted the client IP address field replaced with the X-Forwarded-For header data in your log files, you could add the following to your Apache configuration:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy

SetEnvIf X-Forwarded-For “^.*\..*\..*\..*” forwarded
CustomLog “logs/access_log” combined env=!forwarded
CustomLog “logs/access_log” proxy env=forwarded

This basically says “if the X-Forwarded-For header exists, use that value as the first column in our log file…otherwise, use the remote host’s IP address”. RackWire now offers load balanced solutions. By default, we will setup our load balanced services in non-transparent mode. We recommend that all customers who use our load balancer follow the example above so their Apache log files reflect accurate data. If you have questions about our load balanced solutions, please contact us today!