Showing posts with label Load Balancing. Show all posts
Showing posts with label Load Balancing. Show all posts

Monday, March 12, 2012

Building Apache HTTPD Load Balancer from trunk on Ubuntu 11.10

This post discusses how to install Apache Module mod_proxy_balancer locally.
However, you can just configure mod_proxy load balancer using the builds, without using the source.
Downloading the sources
Download the HTTPD source and extract it
http://httpd.apache.org/download.cgi#apache24

Download APR, APR-Util, and pcre
http://apr.apache.org/download.cgi
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.zip


Unpacking
Unpack APR and APR-Util into ./srclib/apr and ./srclib/apr-util
Be sure the domain names do not have version numbers; for example, the APR distribution must be under ./srclib/apr/
Extract pcre as well.

Building pcre
Go to pcre root directory
sudo ./configure --enable-unicode-properties
make
sudo make install

Configure HTTPD Load Balancer
Go to the httpd root folder.

./configure --with-included-apr --enable-proxy --enable-proxy-balancer
make
sudo make install

Now you have installed the Apache HTTPD Load Balancer locally, to its default location $APACHE2_HOME - /usr/local/apache2/. You can configure it to balance the load across your service instances that to be load balanced.

Sunday, March 11, 2012

Configuring Apache mod_proxy load balancer

Installing Apache2 Server
-------------------
sudo apt-get install apache2
sudo /etc/init.d/apache2 restart
Setting up HTTPS
-----------------
sudo a2enmod ssl
sudo a2ensite default-ssl
Setting up load balancing modules
----------------------------------
sudo a2enmod proxy_balancer
sudo a2enmod proxy_http
Now enable mod_proxy in Apache, and proxy requests to the application server by adding the example below to your Apache httpd.conf
# Put this after the other LoadModule directives
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
cd /etc/apache2/mods-available
sudo vim proxy.conf 

        # set ProxyRequests off since we're only using the ProxyPass and ProxyPassReverse
        # directives. this keeps the server secure from
        # spammers trying to use your proxy to send email.

        ProxyRequests Off

        
                AddDefaultCharset off
                Order deny,allow
                Allow from all
                #Allow from .example.com
        

        # Enable/disable the handling of HTTP/1.1 "Via:" headers.
        # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
        # Set to one of: Off | On | Full | Block

        ProxyVia On

# Put this in the main section of your configuration (or desired virtual host, if using Apache virtual hosts)
ProxyRequests Off
ProxyPreserveHost On


    Order deny,allow
    Allow from all

sudo apt-get install libapache2-mod-proxy-html 
cd /usr/local/apache2/conf
Add the below line to httpd.conf
Include conf/extra/httpd-proxy-balancer.conf


Restart and reload the server
------------------------------------------------
sudo service apache2 restart
sudo service apache2 reload

Tuesday, November 22, 2011

Auto Scaling with WSO2 Load Balancer


Load Balancer is a crucial component in scalable architectures. WSO2 Load Balancer not only balances the load across the application instances, but also scales the system automatically to cater the dynamically changing load. WSO2 Load Balancer is a WSO2 Carbon based product. In this post, we will look how autoscaling works with the Load Balancer.

WSO2 Load Balancer ensures high availability and scalability in the enterprise systems. WSO2 Load Balancer is used in cloud environments to balance the load across the server instances. An ideal use case of the Load Balancer is WSO2 StratosLive, where the service instances are fronted with the load balancers and the system scales automatically as the service gets more web service calls. Having the Apache Tribes Group management framework, Apache Axis2 Clustering module, Apache Synapse mediation framework, and autoscaling component as the major building blocks, WSO2 Load Balancer becomes a complete software load balancer that functions as an autoscaler and a dynamic load balancer.

Architecture

WSO2 Load Balancer can be configured to function as a load balancer with autoscaling on the supported infrastructure. Currently the autoscaler supports EC2 API. Thus the Load Balancer can be configured as a dynamic load balancer with autoscaling, on Amazon EC2 and the other infrastructures compatible with the EC2 API. The autoscaling component uses ec2-client, a Carbon component that functions as a client for the EC2 API and carries out the infrastructure level functionalities. Spawning/starting a new instance, terminating a running instance, managing the service groups, and mapping the elastic IPs are a few of the infrastructure related functionalities that are handled by the autoscaling component.


The autoscaling component comprises of the synapse mediators AutoscaleInMediator and AutoscaleOutMediator and a Synapse Task ServiceRequestsInFlightEC2Autoscaler that functions as the load analyzer task. A system can scale up based on several factors, and hence autoscaling algorithms can easily be written considering the nature of the system. For example, Amazon's Auto Scaler API provides options to scale the system with the system properties such as Load (the timed average of the system load), CPUUtilization (utilization of the cpu at the given instance), or Latency (delay or latency in serving the service requests).

NEXT >>
Now you know the basics of the WSO2 Load Balancer. You might now want to learn,
1) How Auto Scaling works with WSO2 Load Balancer?

Resources
Blog posts
WSO2 StratosLive - An Enterprise Ready Java PaaS
Summer School 2011 - Platform-as-a-Service: The WSO2 Way