The Network Administrator

The weblog of an IT pro specializing in virtualization, storage, servers and networking
  • rss
  • Home
  • About
  • Downloads
  • Contact

Amazon EC2 Load Balancing Options

MWahl | March 21, 2010 | 4:03 pm

I have been looking at different load balancers especially ones that support sticky sessions and that will work on Amazon EC2.

I tried mod_proxy installed on a Fedora 8 AMI using Apache as my front end and then passing sessions to a set of backend Tomcat 6 servers. This did work, but for some reason our application was getting network errors.

I next tried HAProxy installed on a Fedora 8 AMI using HAProxy as my front end and passing sticky sessions to a tomcat 6 server. DNS round robin distributes the visits to each front each server and the sticky session stays with the correct tomcat server. Also if one of the AMIs goes down you have a redundant front end and back end server to continue serving sessions.

HAProxy can be installed using the command Yum install HAProxy*

Using DNS Round Robin I have two separate A records pointing to a set of Elastic IP Addresses each associated to an AMI.

From each Fedora 8 AMI under /etc/haproxy here is my config files.

#Front End Server_Tomcat server 1
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 8192
daemon
user haproxy
group haproxy

defaults
log global
mode http
option httplog
option dontlognull
retries 3
redispatch
maxconn 8192
contimeout 5000
clitimeout 50000
srvtimeout 50000

listen Front_End_Webfarm 0.0.0.0:80

stats enable
stats auth yourusername:yourpassword
balance roundrobin # Load Balancing algorithm
#balance url_param JSESSIONID check_post
option forwardfor # This sets X-Forwarded-For
cookie JSESSIONID
#appsession JSESSIONID prefix
option httpclose
server lb2 tomcatserverprivateipaddress:8080 weight 1 maxconn 150 cookie lb2 inter 10s check
option httpchk OPTIONS /website_path

#Front End Server_Tomcat server 2
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 8192
daemon
user haproxy
group haproxy

defaults
log global
mode http
option httplog
option dontlognull
retries 3
redispatch
maxconn 8192
contimeout 5000
clitimeout 50000
srvtimeout 50000

listen Front_End_Webfarm 0.0.0.0:80

stats enable
stats auth yourusername:yourpassword
balance roundrobin # Load Balancing algorithm
#balance url_param JSESSIONID check_post
option forwardfor # This sets X-Forwarded-For
cookie JSESSIONID
#appsession JSESSIONID prefix
option httpclose
server lb2 tomcatserverprivateipaddress:8080 weight 1 maxconn 150 cookie lb2 inter 10s check
option httpchk OPTIONS /website_path

Don’t forget to run these commands so that haproxy and tomcat will startup after a reboot.
chkconfig --level 2345 tomcat on;
chkconfig --level 2345 haproxy on;

You can go to http://externaldsnname or elasticip/haproxy?stats this will give you some insight into what is happening with HAPROXY.

I am also looking at a product called RightScale which will add a lot of automation options.

Comments
3 Comments »
Categories
Amazon EC2, Web Server load balancing
Comments rss Comments rss
Trackback Trackback

some text

RSS Netcast

  • Increasing your AWS EC2 root partition (Windows) December 14, 2011
  • IIS SSL Certificate into Amazon Elastic Load Balancer December 7, 2011
  • Upgrade an Opsview Appliance August 13, 2011

Categories

  • Activesync (1)
  • Amazon EC2 (5)
  • Amazon S3 (2)
  • Antivirus (1)
  • Blackberry (9)
  • Blackberry Enterprise Server (1)
  • blogs (3)
  • Cisco (6)
  • Citrix Xenapp (2)
  • Databases (2)
  • HTC (1)
  • Internet Explorer (1)
  • iPhone (4)
  • Linux Server (18)
  • Linux tools (11)
  • Microsoft Apps (2)
  • Microsoft Exchange (12)
  • Microsoft Office (1)
  • Microsoft Sharepoint Services (1)
  • Microsoft SQL Server (3)
  • Monitoring (2)
  • MS IIS 6 (1)
  • MYSQL (1)
  • NetCast (3)
  • Networking (19)
  • OpsView/Nagios (1)
  • Photos (1)
  • RAID (1)
  • Scripts (4)
  • Secure FTP (1)
  • Security (10)
  • Smart Phones (1)
  • Tech Preview (8)
  • Uncategorized (40)
  • Virtual Servers (4)
  • Web Browsers (2)
  • Web Server load balancing (1)
  • Web Servers (9)
  • Windows Desktops (17)
  • Windows Server (24)
  • Windows tools (23)
  • WordPress (1)

Recent Posts

  • Increasing your AWS EC2 root partition (Windows)
  • IIS SSL Certificate into Amazon Elastic Load Balancer
  • Upgrade an Opsview Appliance
  • AppAssure Replay First Impressions
  • Linux Boot Process

Archives

Blogroll

  • IT Pro Security Community
  • Jeff Stevenson
  • kevin devin
  • lopsa lopsa
  • MWahl social.microsoft.com
  • Network Security
  • Petri
  • SVROPS
  • Technology blog from bbc
  • technology review
  • THE WAN LAN LORD
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox