BASICS OF SCALING: LOAD BALANCERS



Similar documents
CS 188/219. Scalable Internet Services Andrew Mutz October 8, 2015

3/21/2011. Topics. What is load balancing? Load Balancing

Topics. 1. What is load balancing? 2. Load balancing techniques 3. Load balancing strategies 4. Sessions 5. Elastic load balancing

Web Application Hosting Cloud Architecture

Are You Ready for the Holiday Rush?

Scalability of web applications. CSCI 470: Web Science Keith Vertanen

Architecting ColdFusion For Scalability And High Availability. Ryan Stewart Platform Evangelist

EXECUTIVE SUMMARY CONTENTS. 1. Summary 2. Objectives 3. Methodology and Approach 4. Results 5. Next Steps 6. Glossary 7. Appendix. 1.

Technology and Cost Considerations for Cloud Deployment: Amazon Elastic Compute Cloud (EC2) Case Study

DNS ROUND ROBIN HIGH-AVAILABILITY LOAD SHARING

PES. High Availability Load Balancing in the Agile Infrastructure. Platform & Engineering Services. HEPiX Bologna, April 2013

Load Balancing Web Applications

Design for Failure High Availability Architectures using AWS

Building Success on Acquia Cloud:

Chapter 10: Scalability

always available Cloud

Amazon Web Services Yu Xiao

Large-Scale Web Applications

ZingMe Practice For Building Scalable PHP Website. By Chau Nguyen Nhat Thanh ZingMe Technical Manager Web Technical - VNG

Pertino HA Cluster Deployment: Enabling a Multi- Tier Web Application Using Amazon EC2 and Google CE. A Pertino Deployment Guide

WINDOWS AZURE NETWORKING

Amazon Elastic Beanstalk

TECHNOLOGY WHITE PAPER Jun 2012

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence

LOAD BALANCING TECHNIQUES FOR RELEASE 11i AND RELEASE 12 E-BUSINESS ENVIRONMENTS

5 Easy Steps to Implementing Application Load Balancing for Non-Stop Availability and Higher Performance

Apache Tomcat Clustering

MAGENTO HOSTING Progressive Server Performance Improvements

GeoCloud Project Report USGS/EROS Spatial Data Warehouse Project

Gladinet Cloud Enterprise

Load-Balanced Merak Mail Server

MuleSoft Blueprint: Load Balancing Mule for Scalability and Availability

Availability Digest. Redundant Load Balancing for High Availability July 2013

Load Balancing Advanced Operation Manual

Identifying More Efficient Ways of Load balancing the Web (http) Requests.

Amazon EC2 Product Details Page 1 of 5

Tuning Tableau Server for High Performance

How To Balance A Load Balancer On A Server On A Linux (Or Ipa) (Or Ahem) (For Ahem/Netnet) (On A Linux) (Permanent) (Netnet/Netlan) (Un

Magento & Zend Benchmarks Version 1.2, 1.3 (with & without Flat Catalogs)

Coyote Point Systems White Paper

Web Application Deployment in the Cloud Using Amazon Web Services From Infancy to Maturity

Server Scalability and High Availability

Scaling in the Cloud with AWS. By: Eli White (CTO & mojolive) eliw.com - mojolive.com

ZEN LOAD BALANCER EE v3.04 DATASHEET The Load Balancing made easy

Cache All The Things

CS312 Solutions #6. March 13, 2015

Amazon Web Services Primer. William Strickland COP 6938 Fall 2012 University of Central Florida

Building a Scale-Out SQL Server 2008 Reporting Services Farm

ELIXIR LOAD BALANCER 2

DNS use guidelines in AWS Jan 5, 2015 Version 1.0

Using SUSE Studio to Build and Deploy Applications on Amazon EC2. Guide. Solution Guide Cloud Computing.

Purpose-Built Load Balancing The Advantages of Coyote Point Equalizer over Software-based Solutions

Wikimedia Architecture Doing More With Less. Asher Feldman Ryan Lane Wikimedia Foundation Inc.

TECHNOLOGY WHITE PAPER Jan 2016

Web Application Hosting in the AWS Cloud Best Practices

1. Comments on reviews a. Need to avoid just summarizing web page asks you for:

ArcGIS for Server in the Amazon Cloud. Michele Lundeen Esri

Migrating a running service to AWS

Understanding Evolution's Architecture A Technical Overview

Load Balancing MODX. Garry Nutting, Senior Developer at MODX, LLC

The story of dnsdist - or - Do we need a DNS Delivery Controller?

Managed Amazon Web Services

IERG 4080 Building Scalable Internet-based Services

Simple Tips to Improve Drupal Performance: No Coding Required. By Erik Webb, Senior Technical Consultant, Acquia

WHITE PAPER. Enhancing Application Delivery and Load Balancing on Amazon Web Services with Brocade Virtual Traffic Manager

Monitoring and Scaling My Application

Global Server Load Balancing

Reference Model for Cloud Applications CONSIDERATIONS FOR SW VENDORS BUILDING A SAAS SOLUTION

Guide to the LBaaS plugin ver for Fuel

Hardened Plone. Making Your Plone Site Even More Secure. Presented by: Nathan Van Gheem

How To Set Up Wiremock In Anhtml.Com On A Testnet On A Linux Server On A Microsoft Powerbook 2.5 (Powerbook) On A Powerbook 1.5 On A Macbook 2 (Powerbooks)

Ensuring scalability and performance with Drupal as your audience grows

Fault-Tolerant Computer System Design ECE 695/CS 590. Putting it All Together

Load Balancing for Microsoft Office Communication Server 2007 Release 2

Load Balancing using Pramati Web Load Balancer

Configuring HAproxy as a SwiftStack Load Balancer

Java, PHP & Ruby - Cloud Hosting

This presentation covers virtual application shared services supplied with IBM Workload Deployer version 3.1.

INTERNET INFORMATION SERVICES (IIS) IMPLEMENTATION BEST PRACTICES: By: Terri Donahue, Microsoft IIS MVP

Setting up Dynamicweb for Load Balancing with Microsoft ARR for IIS8

KeyControl Installation on Amazon Web Services

Wednesday, October 10, 12. Running a High Performance LAMP stack on a $20 Virtual Server

Cloud Computing Safe Harbor or Wild West?

Scalable Web Application

Every Silver Lining Has a Vault in the Cloud

Transcription:

BASICS OF SCALING: LOAD BALANCERS Lately, I ve been doing a lot of work on systems that require a high degree of scalability to handle large traffic spikes. This has led to a lot of questions from friends and colleagues on scaling, so I thought I d do a blog series on the basics of scaling. Why Use A Load Balancer? One of the most important pieces of a high scale architecture is the load balancer. Load balancers allow you to distribute load (e.g. HTTP requests) between several servers. This is vital as it allows for horizontal expansion you can increase your capacity (ability to serve xnumber of users) by simply adding more servers. It really depends on your application, but I ve found that web boxes are frequently the bottleneck initially, caused by your programming language of choice (e.g. Python/PHP/Ruby). For example, a small PHP application running on a box with Nginx and PHP-FPM isn t going to have a bottleneck at the database level, but it will be bottlenecked by PHP. Each request is handled by a separate PHP-FPM process, and each PHP-FPM process needs a certain amount of memory. Lets say your server can handle 256 concurrent users. The easiest way to scale at this point is to add more web

boxes. Each web box will increase your capacity by 256 users. However, you need a way of distributing visitors between each web box, and that s where the load balancer comes in. Traditionally in a web server architecture, your load balancer(s) will sit in front of the rest of your stack, directly accepting requests from your users. All traffic will go through your load balancer(s), and get routed to a web box using a defined scheduling algorithm (e.g. sticky sessions, round robin, least load, etc). Other benefits of a load balancer include health checks that can remove an unhealthy server from the pool automatically (e.g. if the server isn t responding,

the load balancer will temporarily stop directing traffic to it). You also eliminate your application/web servers as a single point of failure. Servers can fail, and just be removed from the pool without your visitors noticing. Which Load Balancer? There are many load balancers available, divided into two categories hardware and software load balancers. I recommend starting off with a software load balancer, as hardware load balancers are very expensive and designed for larger infrastructure. Software load balancers include multipurpose applications such as Varnish, Nginx and Apache, as well as dedicated applications like HAProxy. I personally recommend HAProxy as it s a superb piece of software, very fast and reliable. If you re building your infrastructure in AWS, you could also use an ELB, although I don t recommend it as those are closed systems and provide limited customization. Your load balancer should go on a dedicated server, to maximize reliability and resources. Which Scheduling Algorithm? There are three common scheduling algorithms employed by load balancers, and you can traditionally configure which one you d like to use.

Sticky sessions use cookies to ensure a user always hits the same backend server. If your application currently stores state information about a request/user on the server (not a database or other source), this can be useful to add load balancing to your application without making code changes, but I don t recommend it as it can put too much load on one server. Round robin sends each successive request to the next server in the pool, e.g. A -> B -> C -> D -> A. This is the most common load balancing technique, and is normally fine for most websites. Load scheduling directs requests to the server with the lowest load (e.g. CPU load). This is the best load balancing technique and is still quite easy to setup. Not all load balancers support this however. Application Compatability Unless you use sticky sessions, you ll probably have to make changes to your application to be compatible with a load balancing system. The biggest thing that will normally cause issues is stateful information being stored on the server. A great example of this is user sessions. PHP uses file based sessions by default, so a user may login on server A, and there next request goes to server B which doesn t have their session info on it. Luckily, PHP and most other languages and/or frameworks support alternative session storage mechanisms like

Memcached or storing sessions in your database. I most frequently use Memcached based sessions. Any other state information that gets saved to a single server will need to be adapted to be stored in a shared location or replicated amongst servers. Automatic Scaling A logical next step is adding auto scaling to your web/application server cluster. In this system, you would have a management server of some sort that monitors your web server cluster, and automatically adds or removes servers based on load. This works best with a virtualization infrastructure or cloud based hosting such as Amazon AWS. Your management server would then add or remove the instance from your load balancer. Again, if you re using Amazon AWS, they have this built in. It s called Auto Scaling groups, and works well with Amazon ELBs (elastic load balancers). Closing Notes Most large and/or complex architectures will include load balancers at several points throughout the infrastructure, and will normally use a cluster of load balancers at each point to avoid having a single point of failure. Certain DNS providers will allow you to specify multiple IP addresses for a domain name, and it will either return the closest IP to the user, or use a round robin approach (this is

what Google does). If you have 10 web servers, but 1 load balancer, you have a single point of failure that can take down everything. Load balancers are traditionally quite stable, but you should always avoid single points of failure if you want a robust architecture. Imgur s server architecture, pictured above, uses round robin DNS, multiple server clusters, and a cluster of load balancers (shown here as the proxy cluster ). Source: http://brandonwamboldt.ca/basics-of-scaling-load-balancers-1432/