SlideShare a Scribd company logo
1 of 38
Apache Performance Tuning
Part 2: Scaling Out
Sander Temme <sander@temme.net>
Agenda
• Introduction
• Redundancy in Hardware
• Building Out: Separate Tiers
• Building Out: Load Balancing
• Caching Content
• Conclusion
Introduction
• Why do This?
– Scalability (Oh my gosh, I’m so popular!)
– Reliability (We need five nines!)
• Why NOT do This?
– It costs money
Redundancy in Hardware
• Moving Parts Break
– Hard Disks
– Power Supplies
– Hard Disks
– Fans
– Hard Disks
• Buy High Quality Disks
– Refurbished, OEM, Brand Name
– Which has longer warranty?
– Which is more reliable?
Server Configuration
• Mirror those Disks
– Install the RAID utility
– Have it warn you
– RAID is no good if you don’t learn of
failures!
• Redundant Power Supplies
– On different circuits
Scaling Vertically
Scaling Vertically
• Move Services to Other Hosts
• Pros:
– Less resource contention
– Specialized hardware
– Scale out tiers individually
• Cons:
– Development/Deployment harder
– More hosts to manage
Scaling Horizontally
Scaling Horizontally
• Multiple servers per tier
• All receive requests
• All serve same content
• Some arbitration scheme
Load Balancing Schemes
• DNS Tricks
• Peer Server Pools
– Network Load Balancing (Win2k3)
– Wackamole
• Load Balancing Appliance
– Box from F5, Juniper, Cisco, Foundry, …
– Linux Virtual Server
DNS Round-Robin
• Easy!
• Multiple A Records in DNS Zone File
• Not Smart:
– DNS Lookups are cached
– Load on Server
– Server Outage
Example Zone File
scalingout.org. 86400 IN SOA ns.scalingout.org. sctemme.scalingout.org. (
2006051401 ; Serial
86400 ; refresh (1 day)
7200 ; retry (2 hours)
8640000 ; expire (10 days)
86400 ) ; minimum (1 day)
scalingout.org. IN NS bagheera.scalingout.org.
gw IN A 10.11.0.1
bagheera IN A 10.11.0.2
; ...
mail IN CNAME bagheera
ns IN CNAME bagheera
www IN A 10.11.0.113
IN A 10.11.0.114
IN A 10.11.0.115
Peer-based: NLB
• Windows 2000 Server Enterprise Ed.,
Windows Server 2003
• Up to 32 hosts in cluster
• All hosts assume cluster IP, MAC
• NLB makes LB decision
– Only one host gets to answer TCP
handshake
• Should be application independent
Peer-based: Wackamole
• High Availability Solution
• When Host Fails
– Other hosts take over its IP addresses
– Distribute IP addresses among cluster
– Every IP address reliably available
• No Load Balancing!
– Use with RR DNS (or something)
http://www.backhand.org/wackamole/
Load Balancing Device
Client Internet
Load Balancing
• One Load Balancer
• Many Web Servers
• Choice of Balancing Schemes
– Round-robin, Least Used, …
• Reliability
– Heartbeats, unavailable servers don’t
receive requests
• Feature War
Linux Virtual Server
• Free, Open Source, etc.
• IP Virtual Server module in kernel
• Lots of auxiliary modules
– Like a box of Legos
– May come with Your Distribution
• Do It Yourself
http://www.linuxvirtualserver.org/
Example: mod_proxy_balancer
• New in Apache HTTP Server 2.2
• Part of mod_proxy
• Two Load Balancing Methods
– By number of requests
– By number of bytes
• Detects failed backends
Apache Configuration
Listen 80
LogLevel debug
TransferLog logs/access_log
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
ProxyPass / balancer://mycluster/
ProxyPassReverse / http://1.2.3.4:80
ProxyPassReverse / http://1.2.3.5:80
<Proxy balancer://mycluster>
BalancerMember http://1.2.3.4:80
BalancerMember http://1.2.3.5:80
</Proxy>
Example: Tomcat, mod_jk
• Apache + mod_jk
• Multiple Tomcat servers
• Balancer Worker
Apache Configuration
LoadModule jk_module /Volumes/Files/asf/httpd-r415210w/modules/mod_jk.so
JKMount /servlets-examples/* loadbalancer
JKMount /*.jsp loadbalancer
JkMount /jkmanager/* jkstatus
JKLogFile logs/jk_log
JKLogLevel debug
JKWorkerProperty worker.list=loadbalancer,jkstatus
JKWorkerProperty worker.tc1.port=15109
JKWorkerProperty worker.tc1.host=localhost
JKWorkerProperty worker.tc1.type=ajp13
JKWorkerProperty worker.tc1.lbfactor=1
JKWorkerProperty worker.tc2.port=15209
JKWorkerProperty worker.tc2.host=localhost
JKWorkerProperty worker.tc2.type=ajp13
JKWorkerProperty worker.tc2.lbfactor=1
JKWorkerProperty worker.tc3.port=15309
JKWorkerProperty worker.tc3.host=localhost
JKWorkerProperty worker.tc3.type=ajp13
JKWorkerProperty worker.tc3.lbfactor=1
JKWorkerProperty worker.loadbalancer.type=lb
JKWorkerProperty worker.loadbalancer.balance_workers=tc1, tc2, tc3
JKWorkerProperty worker.jkstatus.type=status
Tomcat Configuration
• Put same content on all Tomcats
• Edit conf/server.xml:
• jvmRoute must match jk worker
name!
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tc1">
Problem: Session State
• HTTP is Stateless
• Apps use Sessions
– Cookies
– URL Encoding
• Session created on single server
– Broken by Load Balancing
– PHP: sessions stored on disk
Solutions: Session State
• “Sticky” routing on Load Balancer
• Store State in DB
• Put benign State in Cookie
– But don’t trust the client too much
• Replicate Sessions on Back-end
Tomcat Session Replication
• Share HttpSession objects across
instances
• One instance dies, session lives on
• Apache will route requests to other
instance
• Uses IP Multicast
Session Replication Config
• Uncomment <Cluster> element in
server.xml
• Put empty <distributable /> element in
<web-app> element in web.xml
Caching Content
• Dynamic Content is Expensive
• Static Content Relatively Cheap
• Several Approaches:
– Dynamic caching
– Pre-rendering popular pages
(index.rss…)
27
mod_cache Configuration
28
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /raid1/cacheroot
CacheEnable disk /
# A page modified 100 min. ago will expire in 10 min.
CacheLastModifiedFactor .1
# Always check again after 6 hours
CacheMaxExpire 21600
</IfModule>
</IfModule>
Make Popular Pages Static
• RSS Feeds
• Popular catalog queries
• … (Check your access log)
29
Static Page Substitution
30
<Directory "/home/sctemme/inst/blog/httpd/htdocs">
Options +Indexes
Order allow,deny
Allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cgi-bin/blosxom.cgi/$1 [L,QSA]
</Directory>
Tuning the Database Tier
• Not my area (sorry)
• Give Money to Oracle Consultants
– (or MySQL) (or …)
• Tip: Separate Read and Write
Operations
– Replicate from Write db to Read db
– Read db data slightly stale
• Does it matter?
Putting it All Together
Client
Internet
Read-only
Write-only
Monitoring the Farm
• Monitor for outages
– More boxes, more failure
– HA can mask failures
• Monitor for performance
– Utilization
– Trends
Monitoring Solutions
• Nagios
– Check services, hosts for outage
– Highly configurable, extendable
– Worth your time investment
• Ganglia
– Monitor for performance
– See Brad Nicholes’s session
Monitoring Caveats
• Takes Time, Effort
– Highly flexible products
• You can’t fix it
– If you don’t know it’s broken
• You can’t tune it
– If you don’t know the bottlenecks
Conference Roadmap
• Monitoring 2.0 - Zenoss, the next level of IT
management (Training)
• Apache Performance Tuning Part 1:
Scaling Up
• Load-balancing with Apache HTTPD 2.2
and later
• Scaling the download infrastructure with
your success
• Break My Site
Current Version
http://people.apache.org/~sctemme/ApconEU2008/
Thank You

More Related Content

What's hot

Cloud stack overview
Cloud stack overviewCloud stack overview
Cloud stack overviewgavin_lee
 
2015 deploying flash in the data center
2015 deploying flash in the data center2015 deploying flash in the data center
2015 deploying flash in the data centerHoward Marks
 
XenServer Virtualization In Cloud Environments
XenServer Virtualization In Cloud EnvironmentsXenServer Virtualization In Cloud Environments
XenServer Virtualization In Cloud EnvironmentsTim Mackey
 
Getting Started with Apache CloudStack
Getting Started with Apache CloudStackGetting Started with Apache CloudStack
Getting Started with Apache CloudStackJoe Brockmeier
 
1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ振东 刘
 
Selecting the correct hypervisor for CloudStack 4.5
Selecting the correct hypervisor for CloudStack 4.5Selecting the correct hypervisor for CloudStack 4.5
Selecting the correct hypervisor for CloudStack 4.5Tim Mackey
 
MariaDB on Docker
MariaDB on DockerMariaDB on Docker
MariaDB on DockerMariaDB plc
 
Kafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data ArchitectureKafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data ArchitectureJean-Paul Azar
 

What's hot (10)

Cloud stack overview
Cloud stack overviewCloud stack overview
Cloud stack overview
 
2015 deploying flash in the data center
2015 deploying flash in the data center2015 deploying flash in the data center
2015 deploying flash in the data center
 
XenServer Virtualization In Cloud Environments
XenServer Virtualization In Cloud EnvironmentsXenServer Virtualization In Cloud Environments
XenServer Virtualization In Cloud Environments
 
Aem maintenance
Aem maintenanceAem maintenance
Aem maintenance
 
Getting Started with Apache CloudStack
Getting Started with Apache CloudStackGetting Started with Apache CloudStack
Getting Started with Apache CloudStack
 
1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ1. Core Features of Apache RocketMQ
1. Core Features of Apache RocketMQ
 
Selecting the correct hypervisor for CloudStack 4.5
Selecting the correct hypervisor for CloudStack 4.5Selecting the correct hypervisor for CloudStack 4.5
Selecting the correct hypervisor for CloudStack 4.5
 
Cloud stack for_beginners
Cloud stack for_beginnersCloud stack for_beginners
Cloud stack for_beginners
 
MariaDB on Docker
MariaDB on DockerMariaDB on Docker
MariaDB on Docker
 
Kafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data ArchitectureKafka Tutorial: Streaming Data Architecture
Kafka Tutorial: Streaming Data Architecture
 

Viewers also liked

Empower network (mini)
Empower network (mini)Empower network (mini)
Empower network (mini)grsvtl
 
Blood circulates throughout the body in specific routes or paths called circuits
Blood circulates throughout the body in specific routes or paths called circuitsBlood circulates throughout the body in specific routes or paths called circuits
Blood circulates throughout the body in specific routes or paths called circuitsNoel De Guzman
 
525960-TC0615_selected-pages
525960-TC0615_selected-pages525960-TC0615_selected-pages
525960-TC0615_selected-pagesshanputn
 
Sharon Laverick and Carol Keddie text version
Sharon Laverick and Carol Keddie text versionSharon Laverick and Carol Keddie text version
Sharon Laverick and Carol Keddie text versionLisaKFlint
 
Tttttttrrrrreeeeiuuuuiiii
TttttttrrrrreeeeiuuuuiiiiTttttttrrrrreeeeiuuuuiiii
Tttttttrrrrreeeeiuuuuiiii1001113895
 
Kick your Heart Attack- Top 10 ways to prevent Heart Attack Naturally
Kick your Heart Attack- Top 10 ways to prevent Heart Attack NaturallyKick your Heart Attack- Top 10 ways to prevent Heart Attack Naturally
Kick your Heart Attack- Top 10 ways to prevent Heart Attack NaturallyBharat X Ray Clinic
 
Marketing, Funding, & Partnerships for STEM in Libraries
Marketing, Funding, & Partnerships for STEM in LibrariesMarketing, Funding, & Partnerships for STEM in Libraries
Marketing, Funding, & Partnerships for STEM in LibrariesJennifer Hopwood
 
Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"
Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"
Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"Amplua
 
MP_FMCG_Industry_Forum_Presentation
MP_FMCG_Industry_Forum_PresentationMP_FMCG_Industry_Forum_Presentation
MP_FMCG_Industry_Forum_PresentationAlexander Boyarinov
 
SXSW Presentation Proposal
SXSW Presentation ProposalSXSW Presentation Proposal
SXSW Presentation ProposalMarcus Frödin
 
Gain Property for sale and lease with Sydney Property Valuations
Gain Property for sale and lease with Sydney Property ValuationsGain Property for sale and lease with Sydney Property Valuations
Gain Property for sale and lease with Sydney Property Valuationsanthonyli11
 
Stermedia profile
Stermedia profileStermedia profile
Stermedia profilestermedia
 
Top 10 PA Programs
Top 10 PA ProgramsTop 10 PA Programs
Top 10 PA ProgramsPA Programs
 
Creative Workplace Culture
Creative Workplace CultureCreative Workplace Culture
Creative Workplace CultureDon Southerton
 
Active passive
Active passiveActive passive
Active passiveRabia Khan
 
B2B Brand Clinic Rider SS2016
B2B Brand Clinic Rider SS2016B2B Brand Clinic Rider SS2016
B2B Brand Clinic Rider SS2016AgenturKolm
 

Viewers also liked (20)

Empower network (mini)
Empower network (mini)Empower network (mini)
Empower network (mini)
 
Blood circulates throughout the body in specific routes or paths called circuits
Blood circulates throughout the body in specific routes or paths called circuitsBlood circulates throughout the body in specific routes or paths called circuits
Blood circulates throughout the body in specific routes or paths called circuits
 
525960-TC0615_selected-pages
525960-TC0615_selected-pages525960-TC0615_selected-pages
525960-TC0615_selected-pages
 
Sharon Laverick and Carol Keddie text version
Sharon Laverick and Carol Keddie text versionSharon Laverick and Carol Keddie text version
Sharon Laverick and Carol Keddie text version
 
Tttttttrrrrreeeeiuuuuiiii
TttttttrrrrreeeeiuuuuiiiiTttttttrrrrreeeeiuuuuiiii
Tttttttrrrrreeeeiuuuuiiii
 
Kick your Heart Attack- Top 10 ways to prevent Heart Attack Naturally
Kick your Heart Attack- Top 10 ways to prevent Heart Attack NaturallyKick your Heart Attack- Top 10 ways to prevent Heart Attack Naturally
Kick your Heart Attack- Top 10 ways to prevent Heart Attack Naturally
 
Marketing, Funding, & Partnerships for STEM in Libraries
Marketing, Funding, & Partnerships for STEM in LibrariesMarketing, Funding, & Partnerships for STEM in Libraries
Marketing, Funding, & Partnerships for STEM in Libraries
 
Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"
Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"
Встреча с провайдерами HR и T&D услуг. Организатор "Амплуа"
 
MP_FMCG_Industry_Forum_Presentation
MP_FMCG_Industry_Forum_PresentationMP_FMCG_Industry_Forum_Presentation
MP_FMCG_Industry_Forum_Presentation
 
Rest ws
Rest wsRest ws
Rest ws
 
SXSW Presentation Proposal
SXSW Presentation ProposalSXSW Presentation Proposal
SXSW Presentation Proposal
 
Gain Property for sale and lease with Sydney Property Valuations
Gain Property for sale and lease with Sydney Property ValuationsGain Property for sale and lease with Sydney Property Valuations
Gain Property for sale and lease with Sydney Property Valuations
 
Stermedia profile
Stermedia profileStermedia profile
Stermedia profile
 
Top 10 PA Programs
Top 10 PA ProgramsTop 10 PA Programs
Top 10 PA Programs
 
Creative Workplace Culture
Creative Workplace CultureCreative Workplace Culture
Creative Workplace Culture
 
Hre systems approach
Hre systems approachHre systems approach
Hre systems approach
 
Punto Service - Chi siamo
Punto Service - Chi siamoPunto Service - Chi siamo
Punto Service - Chi siamo
 
Active passive
Active passiveActive passive
Active passive
 
Case Conditions
Case ConditionsCase Conditions
Case Conditions
 
B2B Brand Clinic Rider SS2016
B2B Brand Clinic Rider SS2016B2B Brand Clinic Rider SS2016
B2B Brand Clinic Rider SS2016
 

Similar to Performance out

Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpSander Temme
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applicationsevilmike
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalChapter Three
 
(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool ManagementBIOVIA
 
Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18BIWUG
 
Taking the open cloud to 11
Taking the open cloud to 11Taking the open cloud to 11
Taking the open cloud to 11Joe Brockmeier
 
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...VMworld
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilitycherryhillco
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The SnailMarcus Deglos
 
Whats new in Microsoft Windows Server 2016 Clustering and Storage
Whats new in Microsoft Windows Server 2016 Clustering and StorageWhats new in Microsoft Windows Server 2016 Clustering and Storage
Whats new in Microsoft Windows Server 2016 Clustering and StorageJohn Moran
 
Using flash on the server side
Using flash on the server sideUsing flash on the server side
Using flash on the server sideHoward Marks
 
AWS re:Invent 2013 Recap
AWS re:Invent 2013 RecapAWS re:Invent 2013 Recap
AWS re:Invent 2013 RecapBarry Jones
 
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInJay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInLinkedIn
 
High Performance WordPress II
High Performance WordPress IIHigh Performance WordPress II
High Performance WordPress IIBarry Abrahamson
 
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...NetApp
 
Open stack ha design & deployment kilo
Open stack ha design & deployment   kiloOpen stack ha design & deployment   kilo
Open stack ha design & deployment kiloSteven Li
 
Moving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScaleMoving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScalemmoline
 
Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Serverswebhostingguy
 

Similar to Performance out (20)

Performance out
Performance outPerformance out
Performance out
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
 
Building & Testing Scalable Rails Applications
Building & Testing Scalable Rails ApplicationsBuilding & Testing Scalable Rails Applications
Building & Testing Scalable Rails Applications
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management
 
Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18Pascal benois performance_troubleshooting-spsbe18
Pascal benois performance_troubleshooting-spsbe18
 
Taking the open cloud to 11
Taking the open cloud to 11Taking the open cloud to 11
Taking the open cloud to 11
 
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
 
DrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalabilityDrupalCampLA 2014 - Drupal backend performance and scalability
DrupalCampLA 2014 - Drupal backend performance and scalability
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Whats new in Microsoft Windows Server 2016 Clustering and Storage
Whats new in Microsoft Windows Server 2016 Clustering and StorageWhats new in Microsoft Windows Server 2016 Clustering and Storage
Whats new in Microsoft Windows Server 2016 Clustering and Storage
 
Using flash on the server side
Using flash on the server sideUsing flash on the server side
Using flash on the server side
 
AWS re:Invent 2013 Recap
AWS re:Invent 2013 RecapAWS re:Invent 2013 Recap
AWS re:Invent 2013 Recap
 
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInJay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
 
High Performance WordPress II
High Performance WordPress IIHigh Performance WordPress II
High Performance WordPress II
 
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
TechTarget Event - Storage Architectures for the Modern Data Center - Howard ...
 
Open stack ha design & deployment kilo
Open stack ha design & deployment   kiloOpen stack ha design & deployment   kilo
Open stack ha design & deployment kilo
 
Moving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScaleMoving to the Cloud: AWS, Zend, RightScale
Moving to the Cloud: AWS, Zend, RightScale
 
Beyond Apache: Faster Web Servers
Beyond Apache: Faster Web ServersBeyond Apache: Faster Web Servers
Beyond Apache: Faster Web Servers
 

Recently uploaded

Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryWilliamVickery6
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back17lcow074
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightDelhi Call girls
 
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`dajasot375
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Delhi Call girls
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...Suhani Kapoor
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024CristobalHeraud
 
Kindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpKindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpmainac1
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Yantram Animation Studio Corporation
 
NATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailNATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailDesigntroIntroducing
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...Amil baba
 
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfAmirYakdi
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Douxkojalkojal131
 
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonCheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonDelhi Call girls
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceanilsa9823
 
如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制
如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制
如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制didi bibo
 

Recently uploaded (20)

Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William Vickery
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
 
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
 
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
 
Kindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpKindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUp
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
 
NATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailNATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detail
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
 
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
 
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonCheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
 
如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制
如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制
如何办理(UVa毕业证书)弗吉尼亚大学毕业证毕业证(文凭)成绩单原版一比一定制
 

Performance out

  • 1. Apache Performance Tuning Part 2: Scaling Out Sander Temme <sander@temme.net>
  • 2. Agenda • Introduction • Redundancy in Hardware • Building Out: Separate Tiers • Building Out: Load Balancing • Caching Content • Conclusion
  • 3. Introduction • Why do This? – Scalability (Oh my gosh, I’m so popular!) – Reliability (We need five nines!) • Why NOT do This? – It costs money
  • 4. Redundancy in Hardware • Moving Parts Break – Hard Disks – Power Supplies – Hard Disks – Fans – Hard Disks • Buy High Quality Disks – Refurbished, OEM, Brand Name – Which has longer warranty? – Which is more reliable?
  • 5. Server Configuration • Mirror those Disks – Install the RAID utility – Have it warn you – RAID is no good if you don’t learn of failures! • Redundant Power Supplies – On different circuits
  • 7. Scaling Vertically • Move Services to Other Hosts • Pros: – Less resource contention – Specialized hardware – Scale out tiers individually • Cons: – Development/Deployment harder – More hosts to manage
  • 9. Scaling Horizontally • Multiple servers per tier • All receive requests • All serve same content • Some arbitration scheme
  • 10. Load Balancing Schemes • DNS Tricks • Peer Server Pools – Network Load Balancing (Win2k3) – Wackamole • Load Balancing Appliance – Box from F5, Juniper, Cisco, Foundry, … – Linux Virtual Server
  • 11. DNS Round-Robin • Easy! • Multiple A Records in DNS Zone File • Not Smart: – DNS Lookups are cached – Load on Server – Server Outage
  • 12. Example Zone File scalingout.org. 86400 IN SOA ns.scalingout.org. sctemme.scalingout.org. ( 2006051401 ; Serial 86400 ; refresh (1 day) 7200 ; retry (2 hours) 8640000 ; expire (10 days) 86400 ) ; minimum (1 day) scalingout.org. IN NS bagheera.scalingout.org. gw IN A 10.11.0.1 bagheera IN A 10.11.0.2 ; ... mail IN CNAME bagheera ns IN CNAME bagheera www IN A 10.11.0.113 IN A 10.11.0.114 IN A 10.11.0.115
  • 13. Peer-based: NLB • Windows 2000 Server Enterprise Ed., Windows Server 2003 • Up to 32 hosts in cluster • All hosts assume cluster IP, MAC • NLB makes LB decision – Only one host gets to answer TCP handshake • Should be application independent
  • 14. Peer-based: Wackamole • High Availability Solution • When Host Fails – Other hosts take over its IP addresses – Distribute IP addresses among cluster – Every IP address reliably available • No Load Balancing! – Use with RR DNS (or something) http://www.backhand.org/wackamole/
  • 16. Load Balancing • One Load Balancer • Many Web Servers • Choice of Balancing Schemes – Round-robin, Least Used, … • Reliability – Heartbeats, unavailable servers don’t receive requests • Feature War
  • 17. Linux Virtual Server • Free, Open Source, etc. • IP Virtual Server module in kernel • Lots of auxiliary modules – Like a box of Legos – May come with Your Distribution • Do It Yourself http://www.linuxvirtualserver.org/
  • 18. Example: mod_proxy_balancer • New in Apache HTTP Server 2.2 • Part of mod_proxy • Two Load Balancing Methods – By number of requests – By number of bytes • Detects failed backends
  • 19. Apache Configuration Listen 80 LogLevel debug TransferLog logs/access_log LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so ProxyPass / balancer://mycluster/ ProxyPassReverse / http://1.2.3.4:80 ProxyPassReverse / http://1.2.3.5:80 <Proxy balancer://mycluster> BalancerMember http://1.2.3.4:80 BalancerMember http://1.2.3.5:80 </Proxy>
  • 20. Example: Tomcat, mod_jk • Apache + mod_jk • Multiple Tomcat servers • Balancer Worker
  • 21. Apache Configuration LoadModule jk_module /Volumes/Files/asf/httpd-r415210w/modules/mod_jk.so JKMount /servlets-examples/* loadbalancer JKMount /*.jsp loadbalancer JkMount /jkmanager/* jkstatus JKLogFile logs/jk_log JKLogLevel debug JKWorkerProperty worker.list=loadbalancer,jkstatus JKWorkerProperty worker.tc1.port=15109 JKWorkerProperty worker.tc1.host=localhost JKWorkerProperty worker.tc1.type=ajp13 JKWorkerProperty worker.tc1.lbfactor=1 JKWorkerProperty worker.tc2.port=15209 JKWorkerProperty worker.tc2.host=localhost JKWorkerProperty worker.tc2.type=ajp13 JKWorkerProperty worker.tc2.lbfactor=1 JKWorkerProperty worker.tc3.port=15309 JKWorkerProperty worker.tc3.host=localhost JKWorkerProperty worker.tc3.type=ajp13 JKWorkerProperty worker.tc3.lbfactor=1 JKWorkerProperty worker.loadbalancer.type=lb JKWorkerProperty worker.loadbalancer.balance_workers=tc1, tc2, tc3 JKWorkerProperty worker.jkstatus.type=status
  • 22. Tomcat Configuration • Put same content on all Tomcats • Edit conf/server.xml: • jvmRoute must match jk worker name! <Engine name="Catalina" defaultHost="localhost" jvmRoute="tc1">
  • 23. Problem: Session State • HTTP is Stateless • Apps use Sessions – Cookies – URL Encoding • Session created on single server – Broken by Load Balancing – PHP: sessions stored on disk
  • 24. Solutions: Session State • “Sticky” routing on Load Balancer • Store State in DB • Put benign State in Cookie – But don’t trust the client too much • Replicate Sessions on Back-end
  • 25. Tomcat Session Replication • Share HttpSession objects across instances • One instance dies, session lives on • Apache will route requests to other instance • Uses IP Multicast
  • 26. Session Replication Config • Uncomment <Cluster> element in server.xml • Put empty <distributable /> element in <web-app> element in web.xml
  • 27. Caching Content • Dynamic Content is Expensive • Static Content Relatively Cheap • Several Approaches: – Dynamic caching – Pre-rendering popular pages (index.rss…) 27
  • 28. mod_cache Configuration 28 <IfModule mod_cache.c> <IfModule mod_disk_cache.c> CacheRoot /raid1/cacheroot CacheEnable disk / # A page modified 100 min. ago will expire in 10 min. CacheLastModifiedFactor .1 # Always check again after 6 hours CacheMaxExpire 21600 </IfModule> </IfModule>
  • 29. Make Popular Pages Static • RSS Feeds • Popular catalog queries • … (Check your access log) 29
  • 30. Static Page Substitution 30 <Directory "/home/sctemme/inst/blog/httpd/htdocs"> Options +Indexes Order allow,deny Allow from all RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /cgi-bin/blosxom.cgi/$1 [L,QSA] </Directory>
  • 31. Tuning the Database Tier • Not my area (sorry) • Give Money to Oracle Consultants – (or MySQL) (or …) • Tip: Separate Read and Write Operations – Replicate from Write db to Read db – Read db data slightly stale • Does it matter?
  • 32. Putting it All Together Client Internet Read-only Write-only
  • 33. Monitoring the Farm • Monitor for outages – More boxes, more failure – HA can mask failures • Monitor for performance – Utilization – Trends
  • 34. Monitoring Solutions • Nagios – Check services, hosts for outage – Highly configurable, extendable – Worth your time investment • Ganglia – Monitor for performance – See Brad Nicholes’s session
  • 35. Monitoring Caveats • Takes Time, Effort – Highly flexible products • You can’t fix it – If you don’t know it’s broken • You can’t tune it – If you don’t know the bottlenecks
  • 36. Conference Roadmap • Monitoring 2.0 - Zenoss, the next level of IT management (Training) • Apache Performance Tuning Part 1: Scaling Up • Load-balancing with Apache HTTPD 2.2 and later • Scaling the download infrastructure with your success • Break My Site