SlideShare a Scribd company logo
1 of 48
Load Balancing
     with Apache
   Bradley Holt (http://bradley-holt.com/)
@BradleyHolt (http://twitter.com/BradleyHolt)
About Me
Co-Founder and
Technical Director
Contributor
Author




         http://oreilly.com/catalog/9781449303129/   http://oreilly.com/catalog/9781449303433/
Apache HTTP Server
About Apache
Open source

Serves over 100 million websites

Can run in many different modes, depending on your needs,
via MultiProcessing Modules (MPMs)

The Apache Software Foundation (ASF) supports many other
open source software projects
Alternatives
Software Load Balancers
HAProxy

Varnish

Pound

Perlbal

Squid

nginx

Linux-HA (High-Availability Linux) on Linux Standard Base (LSB)
Hosted Load Balancers
Amazon’s Elastic Load Balancing

Rackspace Cloud Load Balancers
Shared Nothing Architecture (SN)
Properties of a SN System
Each node operates independently

No single point of contention

PHP is shared nothing by default…
Breaking SN
Sessions require sharing (or require the use of sticky sessions)

Databases are the most common single point of contention
(this is why eventual consistency is important)

Storing variables in memory between requests breaks SN
(possible in Java and .NET)
Practical SN Techniques
Store sessions in a memcached cluster—this makes web nodes SN

For database applications:
  • send writes to a write-only master
  • replicate to multiple read-only nodes
  • read-only nodes are now effectively SN
Clustering/partitioning/sharding can help, too (but painful).

Alternatively, use a “NoSQL” database (e.g. CouchDB is SN).
Load Balancing Examples
Required Modules
mod_proxy

mod_proxy_http (assuming you’re load balancing HTTP requests)

mod_proxy_balancer

mod_headers (for sticky sessions)

mod_rewrite (for advanced con gurations)
Basic Load Balancing
# Create a load balancer named "web-nodes"
<Proxy balancer://web-nodes>
    # Add three load balancer members
    BalancerMember http://www1.example.com
    BalancerMember http://www2.example.com
    BalancerMember http://www3.example.com
</Proxy>
# Send all requests to the "web-nodes" balancer
ProxyPass / balancer://web-nodes
Apache allows traffic to be
balanced by number of requests
(lbmethod=byrequests), bytes
transferred (lbmethod=bytraffic),
or by the number of currently pending
requests (lbmethod=bybusyness).
Sticky Sessions in PHP
(your mileage may vary)
# Create a load balancer named "web-nodes"
<Proxy balancer://web-nodes>
    # Add three load balancer members
    BalancerMember http://www1.example.com
    BalancerMember http://www2.example.com
    BalancerMember http://www3.example.com
    # Use the PHPSESSID for sticky sessions
    ProxySet stickysession=PHPSESSID
</Proxy>
# Send all requests to the "web-nodes" balancer
ProxyPass / balancer://web-nodes
Create Your Own Sticky Sessions
# Set a cookie
Header add Set-Cookie 
"NODE=%{BALANCER_WORKER_ROUTE}e; path=/" 
env=BALANCER_ROUTE_CHANGED
# Create a load balancer named "web-nodes"
<Proxy balancer://web-nodes>
    # Add three load balancer members
    BalancerMember http://www1.example.com route=1
    BalancerMember http://www2.example.com route=2
    BalancerMember http://www3.example.com route=3
    # Use the NODE cookie for sticky sessions
    ProxySet stickysession=NODE
</Proxy>
# Send all requests to the "web-nodes" balancer
ProxyPass / balancer://web-nodes
Use a private network to connect your
load balancer to your balancer
members.

This allows for dedicated bandwidth
and opens up the possibility of
offloading SSL handling to the load
balancer.
Route Based on HTTP Method
# Enable mod_rewrite
RewriteEngine On

# Send POST, PUT, and DELETEs to "write" balancer
RewriteCond %{REQUEST_METHOD} ^(POST|PUT|DELETE)$
RewriteRule ^/(.*)$ balancer://write$1 [P]

# Send GET, HEAD, and OPTIONS to "read" balancer
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD|OPTIONS)$
RewriteRule ^/(.*)$ balancer://read$1 [P]

# Modify HTTP response headers (e.g. Location)
ProxyPassReverse / balancer://write
ProxyPassReverse / balancer://read
Consider con guring multiple load
balancers, removing the load balancer
as a single point of failure.

This typically involves having two or
more load balancers sharing the same
IP address, with one con gured as a
failover.
Distributed Load Testing with Tsung
Tsung
Distributes load testing across multiple testing clients

Can generate huge numbers of concurrent users

Monitors CPU, memory, load, and network traffic

Simulates dynamic sessions, as described in a con guration le

Randomizes traffic patterns based on de ned probabilities

Recording and playback of sessions

HTML reports and graphs
XML Con guration File
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
  <!-- … -->
</tsung>
Client Side Setup
<!-- Client side setup -->
<clients>
  <client
     host="test-a"
     weight="1"
     maxusers="10000"
     cpu="4"
  />
  <client
     host="test-b"
     weight="1"
     maxusers="10000"
     cpu="4"
  />
</clients>
Server Side Setup
<!-- Server side setup -->
<servers>
  <server
     host="www"
     port="80"
     type="tcp"
  />
</servers>
Load Setup
<!-- Load setup -->
<load>
  <arrivalphase
    phase="1"
    duration="5"
    unit="minute"
  >
    <users
       arrivalrate="200"
       unit="second"
    />
  </arrivalphase>
</load>
Session Setup
<!-- Session setup -->
<session
  name="default"
  probability="100"
  type="ts_http"
>
  <thinktime
     value="1"
     random="true"
  />
  <request>
     <http
       method="GET"
       url="/"
       />
  </request>
</session>
Monitoring Setup
Tsung allows for monitoring
using Erlang, SNMP, or Munin
<!-- Monitoring setup -->
<monitoring>
  <monitor host="www" type="munin" />
  <monitor host="www1" type="munin" />
  <monitor host="www2" type="munin" />
  <monitor host="www3" type="munin" />
</monitoring>
Reports
From Scaling CouchDB by Bradley Holt (O’Reilly). Copyright 2011 Bradley Holt, 978-1-449-30343-3
Graphs
From Scaling CouchDB by Bradley Holt (O’Reilly). Copyright 2011 Bradley Holt, 978-1-449-30343-3
Questions?
Thank You
                Bradley Holt (http://bradley-holt.com/)
             @BradleyHolt (http://twitter.com/BradleyHolt)




Copyright © 2011 Bradley Holt. All rights reserved.

More Related Content

What's hot

Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
 Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
Spark Operator—Deploy, Manage and Monitor Spark clusters on KubernetesDatabricks
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMiguel Araújo
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Mydbops
 
Reactive Microservices with Quarkus
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with QuarkusNiklas Heidloff
 
What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...
What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...
What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...Edureka!
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMongoDB
 
Tuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkTuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkPatrick Wendell
 
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...Amazon Web Services Korea
 
Parquet performance tuning: the missing guide
Parquet performance tuning: the missing guideParquet performance tuning: the missing guide
Parquet performance tuning: the missing guideRyan Blue
 
Apache Atlas: Tracking dataset lineage across Hadoop components
Apache Atlas: Tracking dataset lineage across Hadoop componentsApache Atlas: Tracking dataset lineage across Hadoop components
Apache Atlas: Tracking dataset lineage across Hadoop componentsDataWorks Summit/Hadoop Summit
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기NHN FORWARD
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera ClusterAbdul Manaf
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesKenny Gryp
 
Near Real-Time Data Warehousing with Apache Spark and Delta Lake
Near Real-Time Data Warehousing with Apache Spark and Delta LakeNear Real-Time Data Warehousing with Apache Spark and Delta Lake
Near Real-Time Data Warehousing with Apache Spark and Delta LakeDatabricks
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr VronskiyFwdays
 
Airbyte @ Airflow Summit - The new modern data stack
Airbyte @ Airflow Summit - The new modern data stackAirbyte @ Airflow Summit - The new modern data stack
Airbyte @ Airflow Summit - The new modern data stackMichel Tricot
 
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike SteenbergenMeet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergendistributed matters
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesBruno Borges
 

What's hot (20)

Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
 Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
 
MySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA ToolMySQL Shell - The Best MySQL DBA Tool
MySQL Shell - The Best MySQL DBA Tool
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
 
Reactive Microservices with Quarkus
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with Quarkus
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...
What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...
What is Hadoop | Introduction to Hadoop | Hadoop Tutorial | Hadoop Training |...
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Tuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkTuning and Debugging in Apache Spark
Tuning and Debugging in Apache Spark
 
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
옵저버빌러티(Observability) 확보로 서버리스 마이크로서비스 들여다보기 - 김형일 AWS 솔루션즈 아키텍트 :: AWS Summi...
 
Parquet performance tuning: the missing guide
Parquet performance tuning: the missing guideParquet performance tuning: the missing guide
Parquet performance tuning: the missing guide
 
Apache Atlas: Tracking dataset lineage across Hadoop components
Apache Atlas: Tracking dataset lineage across Hadoop componentsApache Atlas: Tracking dataset lineage across Hadoop components
Apache Atlas: Tracking dataset lineage across Hadoop components
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
 
Mule caching strategy with redis cache
Mule caching strategy with redis cacheMule caching strategy with redis cache
Mule caching strategy with redis cache
 
Near Real-Time Data Warehousing with Apache Spark and Delta Lake
Near Real-Time Data Warehousing with Apache Spark and Delta LakeNear Real-Time Data Warehousing with Apache Spark and Delta Lake
Near Real-Time Data Warehousing with Apache Spark and Delta Lake
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy
 
Airbyte @ Airflow Summit - The new modern data stack
Airbyte @ Airflow Summit - The new modern data stackAirbyte @ Airflow Summit - The new modern data stack
Airbyte @ Airflow Summit - The new modern data stack
 
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike SteenbergenMeet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
 
Secrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
 

Viewers also liked

Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008laonap166
 
Apache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden GemApache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden GemJim Jagielski
 
Scaling Your Web Application
Scaling Your Web ApplicationScaling Your Web Application
Scaling Your Web ApplicationKetan Deshmukh
 
Scaling your web app with MySQL replication
Scaling your web app with MySQL replicationScaling your web app with MySQL replication
Scaling your web app with MySQL replicationGiuseppe Maxia
 
Meetup TestingAR 2016 - Performance testing durante y después
Meetup TestingAR 2016 - Performance testing durante y despuésMeetup TestingAR 2016 - Performance testing durante y después
Meetup TestingAR 2016 - Performance testing durante y despuésFederico Toledo
 
Load testing with Telerik Test Studio
Load testing with Telerik Test StudioLoad testing with Telerik Test Studio
Load testing with Telerik Test StudioTelerik Test Studio
 
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...Federico Toledo
 
Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule” Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule” cvikash
 
Load & Performance TESTING
Load & Performance TESTINGLoad & Performance TESTING
Load & Performance TESTINGGuido Serra
 
CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...
CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...
CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...Federico Toledo
 
Tsung Intro presentation 2013
Tsung Intro presentation 2013Tsung Intro presentation 2013
Tsung Intro presentation 2013Steffen Larsen
 
Web Server Load Balancer
Web Server Load BalancerWeb Server Load Balancer
Web Server Load BalancerMobME Technical
 
HAProxy scale out using open source
HAProxy scale out using open sourceHAProxy scale out using open source
HAProxy scale out using open sourceIngo Walz
 
A Gentoo Environment at Gaikai
A Gentoo Environment at GaikaiA Gentoo Environment at Gaikai
A Gentoo Environment at GaikaiGuido Serra
 
Lessons from Highly Scalable Architectures at Social Networking Sites
Lessons from Highly Scalable Architectures at Social Networking SitesLessons from Highly Scalable Architectures at Social Networking Sites
Lessons from Highly Scalable Architectures at Social Networking SitesPatrick Senti
 
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...Federico Toledo
 

Viewers also liked (20)

Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008Cấu hình network load balancing trên windows server 2008
Cấu hình network load balancing trên windows server 2008
 
Apache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden GemApache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden Gem
 
Scaling Your Web Application
Scaling Your Web ApplicationScaling Your Web Application
Scaling Your Web Application
 
Scaling your web app with MySQL replication
Scaling your web app with MySQL replicationScaling your web app with MySQL replication
Scaling your web app with MySQL replication
 
Load balancing
Load balancingLoad balancing
Load balancing
 
Meetup TestingAR 2016 - Performance testing durante y después
Meetup TestingAR 2016 - Performance testing durante y despuésMeetup TestingAR 2016 - Performance testing durante y después
Meetup TestingAR 2016 - Performance testing durante y después
 
Load testing with Telerik Test Studio
Load testing with Telerik Test StudioLoad testing with Telerik Test Studio
Load testing with Telerik Test Studio
 
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
QA&test 2016 (Bilbao) Pros and Cons of Doing Performance Testing Along with D...
 
Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule” Freeing India of “Divide & Rule”
Freeing India of “Divide & Rule”
 
Load & Performance TESTING
Load & Performance TESTINGLoad & Performance TESTING
Load & Performance TESTING
 
CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...
CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...
CMG imPACt2016 - Mobile performance testing - Vendor training - Federico Tole...
 
HAProxy
HAProxy HAProxy
HAProxy
 
Tsung Intro presentation 2013
Tsung Intro presentation 2013Tsung Intro presentation 2013
Tsung Intro presentation 2013
 
Web Server Load Balancer
Web Server Load BalancerWeb Server Load Balancer
Web Server Load Balancer
 
HAProxy scale out using open source
HAProxy scale out using open sourceHAProxy scale out using open source
HAProxy scale out using open source
 
XenApp Load Balancing
XenApp Load BalancingXenApp Load Balancing
XenApp Load Balancing
 
A Gentoo Environment at Gaikai
A Gentoo Environment at GaikaiA Gentoo Environment at Gaikai
A Gentoo Environment at Gaikai
 
Lessons from Highly Scalable Architectures at Social Networking Sites
Lessons from Highly Scalable Architectures at Social Networking SitesLessons from Highly Scalable Architectures at Social Networking Sites
Lessons from Highly Scalable Architectures at Social Networking Sites
 
Class warshal2
Class warshal2Class warshal2
Class warshal2
 
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...
Meetup Testing Workshop 2016 - Gatling para pruebas de performance - Federico...
 

Similar to Load Balancing with Apache

Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Baruch Sadogursky
 
ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4Jim Jagielski
 
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...Codemotion
 
Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Giovanni Bechis
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hostingwebhostingguy
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Eran Harel
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Webinar Slides: New Tungsten Dashboard - Overview, Installation and Architecture
Webinar Slides: New Tungsten Dashboard - Overview, Installation and ArchitectureWebinar Slides: New Tungsten Dashboard - Overview, Installation and Architecture
Webinar Slides: New Tungsten Dashboard - Overview, Installation and ArchitectureContinuent
 
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...Continuent
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisationgrooverdan
 
Load Impact
Load Impact Load Impact
Load Impact z-999
 
Tips
TipsTips
Tipsmclee
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011Mike Willbanks
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...Aman Kohli
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-serverHARRY CHAN PUTRA
 
Using Apache as an Application Server
Using Apache as an Application ServerUsing Apache as an Application Server
Using Apache as an Application ServerPhil Windley
 

Similar to Load Balancing with Apache (20)

Apache - Quick reference guide
Apache - Quick reference guideApache - Quick reference guide
Apache - Quick reference guide
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java
 
ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4ApacheConNA 2015: What's new in Apache httpd 2.4
ApacheConNA 2015: What's new in Apache httpd 2.4
 
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Milan ...
 
5-WebServers.ppt
5-WebServers.ppt5-WebServers.ppt
5-WebServers.ppt
 
Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD
 
Apache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual HostingApache web server installation/configuration, Virtual Hosting
Apache web server installation/configuration, Virtual Hosting
 
Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)Service discovery like a pro (presented at reversimX)
Service discovery like a pro (presented at reversimX)
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
5-WebServers.ppt
5-WebServers.ppt5-WebServers.ppt
5-WebServers.ppt
 
Webinar Slides: New Tungsten Dashboard - Overview, Installation and Architecture
Webinar Slides: New Tungsten Dashboard - Overview, Installation and ArchitectureWebinar Slides: New Tungsten Dashboard - Overview, Installation and Architecture
Webinar Slides: New Tungsten Dashboard - Overview, Installation and Architecture
 
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...
Training Slides: Basics 106: Tungsten Dashboard Overview, Installation and Ar...
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisation
 
Load Impact
Load Impact Load Impact
Load Impact
 
Server Side? Swift
Server Side? SwiftServer Side? Swift
Server Side? Swift
 
Tips
TipsTips
Tips
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-server
 
Using Apache as an Application Server
Using Apache as an Application ServerUsing Apache as an Application Server
Using Apache as an Application Server
 

More from Bradley Holt

Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Bradley Holt
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven DesignBradley Holt
 
Entity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonEntity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonBradley Holt
 
CouchConf NYC CouchApps
CouchConf NYC CouchAppsCouchConf NYC CouchApps
CouchConf NYC CouchAppsBradley Holt
 
ZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignBradley Holt
 
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDBZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDBBradley Holt
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsBradley Holt
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchAppsBradley Holt
 
OSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBOSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBBradley Holt
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHPBradley Holt
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3Bradley Holt
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHPBradley Holt
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web ServicesBradley Holt
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughBradley Holt
 
Burlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBurlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBradley Holt
 

More from Bradley Holt (16)

Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012Domain-Driven Design at ZendCon 2012
Domain-Driven Design at ZendCon 2012
 
Domain-Driven Design
Domain-Driven DesignDomain-Driven Design
Domain-Driven Design
 
Entity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf BostonEntity Relationships in a Document Database at CouchConf Boston
Entity Relationships in a Document Database at CouchConf Boston
 
CouchConf NYC CouchApps
CouchConf NYC CouchAppsCouchConf NYC CouchApps
CouchConf NYC CouchApps
 
ZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven DesignZendCon 2011 UnCon Domain-Driven Design
ZendCon 2011 UnCon Domain-Driven Design
 
ZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDBZendCon 2011 Learning CouchDB
ZendCon 2011 Learning CouchDB
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchApps
 
OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchApps
 
OSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDBOSCON 2011 Learning CouchDB
OSCON 2011 Learning CouchDB
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHP
 
Intermediate PHP
Intermediate PHPIntermediate PHP
Intermediate PHP
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
Burlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion PresentationBurlington, VT PHP Users Group Subversion Presentation
Burlington, VT PHP Users Group Subversion Presentation
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

Load Balancing with Apache

  • 1. Load Balancing with Apache Bradley Holt (http://bradley-holt.com/) @BradleyHolt (http://twitter.com/BradleyHolt)
  • 5. Author http://oreilly.com/catalog/9781449303129/ http://oreilly.com/catalog/9781449303433/
  • 7. About Apache Open source Serves over 100 million websites Can run in many different modes, depending on your needs, via MultiProcessing Modules (MPMs) The Apache Software Foundation (ASF) supports many other open source software projects
  • 9. Software Load Balancers HAProxy Varnish Pound Perlbal Squid nginx Linux-HA (High-Availability Linux) on Linux Standard Base (LSB)
  • 10. Hosted Load Balancers Amazon’s Elastic Load Balancing Rackspace Cloud Load Balancers
  • 12. Properties of a SN System Each node operates independently No single point of contention PHP is shared nothing by default…
  • 13. Breaking SN Sessions require sharing (or require the use of sticky sessions) Databases are the most common single point of contention (this is why eventual consistency is important) Storing variables in memory between requests breaks SN (possible in Java and .NET)
  • 14. Practical SN Techniques Store sessions in a memcached cluster—this makes web nodes SN For database applications: • send writes to a write-only master • replicate to multiple read-only nodes • read-only nodes are now effectively SN Clustering/partitioning/sharding can help, too (but painful). Alternatively, use a “NoSQL” database (e.g. CouchDB is SN).
  • 16. Required Modules mod_proxy mod_proxy_http (assuming you’re load balancing HTTP requests) mod_proxy_balancer mod_headers (for sticky sessions) mod_rewrite (for advanced con gurations)
  • 18. # Create a load balancer named "web-nodes" <Proxy balancer://web-nodes> # Add three load balancer members BalancerMember http://www1.example.com BalancerMember http://www2.example.com BalancerMember http://www3.example.com </Proxy> # Send all requests to the "web-nodes" balancer ProxyPass / balancer://web-nodes
  • 19. Apache allows traffic to be balanced by number of requests (lbmethod=byrequests), bytes transferred (lbmethod=bytraffic), or by the number of currently pending requests (lbmethod=bybusyness).
  • 20. Sticky Sessions in PHP (your mileage may vary)
  • 21. # Create a load balancer named "web-nodes" <Proxy balancer://web-nodes> # Add three load balancer members BalancerMember http://www1.example.com BalancerMember http://www2.example.com BalancerMember http://www3.example.com # Use the PHPSESSID for sticky sessions ProxySet stickysession=PHPSESSID </Proxy> # Send all requests to the "web-nodes" balancer ProxyPass / balancer://web-nodes
  • 22. Create Your Own Sticky Sessions
  • 23. # Set a cookie Header add Set-Cookie "NODE=%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED # Create a load balancer named "web-nodes" <Proxy balancer://web-nodes> # Add three load balancer members BalancerMember http://www1.example.com route=1 BalancerMember http://www2.example.com route=2 BalancerMember http://www3.example.com route=3 # Use the NODE cookie for sticky sessions ProxySet stickysession=NODE </Proxy> # Send all requests to the "web-nodes" balancer ProxyPass / balancer://web-nodes
  • 24. Use a private network to connect your load balancer to your balancer members. This allows for dedicated bandwidth and opens up the possibility of offloading SSL handling to the load balancer.
  • 25. Route Based on HTTP Method
  • 26. # Enable mod_rewrite RewriteEngine On # Send POST, PUT, and DELETEs to "write" balancer RewriteCond %{REQUEST_METHOD} ^(POST|PUT|DELETE)$ RewriteRule ^/(.*)$ balancer://write$1 [P] # Send GET, HEAD, and OPTIONS to "read" balancer RewriteCond %{REQUEST_METHOD} ^(GET|HEAD|OPTIONS)$ RewriteRule ^/(.*)$ balancer://read$1 [P] # Modify HTTP response headers (e.g. Location) ProxyPassReverse / balancer://write ProxyPassReverse / balancer://read
  • 27. Consider con guring multiple load balancers, removing the load balancer as a single point of failure. This typically involves having two or more load balancers sharing the same IP address, with one con gured as a failover.
  • 29. Tsung Distributes load testing across multiple testing clients Can generate huge numbers of concurrent users Monitors CPU, memory, load, and network traffic Simulates dynamic sessions, as described in a con guration le Randomizes traffic patterns based on de ned probabilities Recording and playback of sessions HTML reports and graphs
  • 31. <?xml version="1.0"?> <!DOCTYPE tsung SYSTEM "/usr/share/tsung/tsung-1.0.dtd"> <tsung loglevel="notice" version="1.0"> <!-- … --> </tsung>
  • 33. <!-- Client side setup --> <clients> <client host="test-a" weight="1" maxusers="10000" cpu="4" /> <client host="test-b" weight="1" maxusers="10000" cpu="4" /> </clients>
  • 35. <!-- Server side setup --> <servers> <server host="www" port="80" type="tcp" /> </servers>
  • 37. <!-- Load setup --> <load> <arrivalphase phase="1" duration="5" unit="minute" > <users arrivalrate="200" unit="second" /> </arrivalphase> </load>
  • 39. <!-- Session setup --> <session name="default" probability="100" type="ts_http" > <thinktime value="1" random="true" /> <request> <http method="GET" url="/" /> </request> </session>
  • 41. Tsung allows for monitoring using Erlang, SNMP, or Munin
  • 42. <!-- Monitoring setup --> <monitoring> <monitor host="www" type="munin" /> <monitor host="www1" type="munin" /> <monitor host="www2" type="munin" /> <monitor host="www3" type="munin" /> </monitoring>
  • 44. From Scaling CouchDB by Bradley Holt (O’Reilly). Copyright 2011 Bradley Holt, 978-1-449-30343-3
  • 46. From Scaling CouchDB by Bradley Holt (O’Reilly). Copyright 2011 Bradley Holt, 978-1-449-30343-3
  • 48. Thank You Bradley Holt (http://bradley-holt.com/) @BradleyHolt (http://twitter.com/BradleyHolt) Copyright © 2011 Bradley Holt. All rights reserved.

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n