SlideShare a Scribd company logo
1 of 17
Download to read offline
HAProxy
ARINDAM NAYAK
Agenda
•What is HAProxy?
•When to use?
•Who uses HAProxy?
•Similar Products & comparisons
•Why HAProxy?
•Examples
•Where it can be used?
•Design consideration
•How to implement
•Benchmarking – Comparing metrics before implementing HAProxy and after implementation.
[ Above point will be covered in next sessions  ]
What is HAProxy?
HAProxy is a free, very fast and reliable solution offering
high availability, load balancing, and proxying for TCP and
HTTP-based applications
● Proxying
● Load balancing , Scale out, Failover ( Health Checks)
● High availability
When to use?
•Websites with very high loads.
•Multiple connection to website.
•Load Balancing required at HTTP and TCP level.
•Fault Tolerance
•Maximize Availability
•Maximize throughput
•Horizontal Scaling
Who uses HAProxy?
•Stack Overflow
•Server Fault
•GitHub
•Tumblr
•Twitter
•Imgur – Image hosting / sharing
•Instagram – Image hosting/sharing
•Reddit
………….
For more users, refer - http://www.haproxy.org/they-use-it.html
Similar Products & comparisons
•Nginx – Reverse proxy server , Load balancing , web server ..
•Linux Virtual server – Runs in kernel mode, routes packets. - "fast as hell", but rigid as the kernel
•Asp.Net WebFarm
•AWS Elastic Load Balancer – Works with AWS or servers under AWS VPC.
•F5 – Commercial
•Varnish – Primarily focused on HTTP
•……………….
Why HAProxy?
Out of band health checks – Monitors server health by sending requests at configured intervals
which are independent of incoming traffic
Works on TCP
More Algorithm option – Support more number of algorithm to select backend server.
Open Source product.
Speed. It’s really, really fast.
Hot reconfiguration – Don’t need to put in maintenance mode and change config.
Examples
•Load balance all png, jpg, gif requests to a specific server(s).
•Load balance all mov, avi, mkv requests to a specific server(s).
•Load balance users in South East US IP range to southeast.yoursite.com
•Proxying users by ranking (gold customers, silver, bronze).
Where it can be used?
•Linux 2.4 on x86, x86_64, Alpha, Sparc, MIPS, PARISC
•Linux 2.6 / 3.x on x86, x86_64, ARM, Sparc, PPC64
•Solaris 8/9 on UltraSPARC 2 and 3
•Solaris 10 on Opteron and UltraSPARC
•FreeBSD 4.10 - 10 on x86
•OpenBSD 3.1 to -current on i386, amd64, macppc, alpha, sparc64 and VAX (check the ports)
•AIX 5.1 - 5.3 on Power™ architecture
Design consideration
Need to segregate DB Server from App Server.
Design consideration
(Contd.)
Clustering DB server.
• All applications access the cluster via one single IP. The topology of the database cluster is masked
behind HAProxy.
• MySQL Connections are load-balanced between available DB nodes
• It is possible to add or remove database nodes without any changes to the applications.
• Once the max number of database connections (in MySQL) is reached, HAProxy queues additional new
connections. This is a neat way of throttling database connection requests and achieves overload
protection.
Managing sessions:
◦ Set up sticky session in HAProxy
◦ Use centralized session management like Redis, Memcache
How to implement
Download and install HAProxy.
Jump to config file and set following
◦ Access control list
◦ Bankend
◦ Frontend
Few Algorithm for selecting back-end server.
• Roundrobin - selects servers in turns. This is the default algorithm.
• Leastconn - Selects the server with the least number of connections--it is recommended for longer
sessions.
• Source- This selects which server to use based on a hash of the source IP i.e. your user's IP address. This
is one method to ensure that a user will connect to the same server.
How to implement
(Contd.)
How to implement
(Contd.)
Load balancers are generally grouped into two categories: Layer 4 and Layer 7. Layer 4
load balancers act upon data found in network and transport layer protocols (IP, TCP, FTP, UDP).
Layer 7 load balancers distribute requests based upon data found in application layer protocols
such as HTTP.
Node.Js App – HTTP Listener for different ports.
HAProxy to make reverse proxy for port – 80 to others listed above.
DEMO
Browser Console
Monitoring via Nagios, Scout
Benchmarking
Will be covered in next session.
Reference
•http://www.haproxy.org/
•https://www.digitalocean.com/community/tutorials/an-introduction-to-haproxy-and-load-
balancing-concepts
•https://signalvnoise.com/posts/1073-nuts-bolts-haproxy
•http://blog.kloud.com.au/2013/07/04/elbs-do-not-cater-for-your-environment-set-up-haproxy-
for-your-iis-servers-2/
•http://blog.stackoverflow.com/2010/01/stack-overflow-network-configuration/
•http://mervine.net/comparing-load-balancing
•https://serversforhackers.com/haproxy/
Thank you

More Related Content

Similar to haproxy-150423120602-conversion-gate01.pdf

Performance and Scalability Tuning
Performance and Scalability TuningPerformance and Scalability Tuning
Performance and Scalability Tuning
Andres March
 
Media Source Extensions
Media Source ExtensionsMedia Source Extensions
Media Source Extensions
FITC
 
High Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningHigh Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance Tuning
Albert Chen
 
Apache Hadoop YARN: best practices
Apache Hadoop YARN: best practicesApache Hadoop YARN: best practices
Apache Hadoop YARN: best practices
DataWorks Summit
 

Similar to haproxy-150423120602-conversion-gate01.pdf (20)

Azure Web App services
Azure Web App servicesAzure Web App services
Azure Web App services
 
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
 
HPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journeyHPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journey
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP Applications
 
HPC Controls Future
HPC Controls FutureHPC Controls Future
HPC Controls Future
 
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构
 
Open stack ha design & deployment kilo
Open stack ha design & deployment   kiloOpen stack ha design & deployment   kilo
Open stack ha design & deployment kilo
 
Performance and Scalability Tuning
Performance and Scalability TuningPerformance and Scalability Tuning
Performance and Scalability Tuning
 
Hadoop engineering bo_f_final
Hadoop engineering bo_f_finalHadoop engineering bo_f_final
Hadoop engineering bo_f_final
 
Simplifying Hyper-V Management for VMware Administrators
Simplifying Hyper-V Management for VMware AdministratorsSimplifying Hyper-V Management for VMware Administrators
Simplifying Hyper-V Management for VMware Administrators
 
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
 
Media Source Extensions
Media Source ExtensionsMedia Source Extensions
Media Source Extensions
 
Varnish extend introduction
Varnish extend introductionVarnish extend introduction
Varnish extend introduction
 
High Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance TuningHigh Concurrency Architecture and Laravel Performance Tuning
High Concurrency Architecture and Laravel Performance Tuning
 
Route Origin Validation - A MANRS Approach
Route Origin Validation - A MANRS ApproachRoute Origin Validation - A MANRS Approach
Route Origin Validation - A MANRS Approach
 
webservers
webserverswebservers
webservers
 
High availability
High availabilityHigh availability
High availability
 
EKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdfEKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdf
 
Apache Hadoop YARN: best practices
Apache Hadoop YARN: best practicesApache Hadoop YARN: best practices
Apache Hadoop YARN: best practices
 

Recently uploaded

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (20)

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 

haproxy-150423120602-conversion-gate01.pdf

  • 2. Agenda •What is HAProxy? •When to use? •Who uses HAProxy? •Similar Products & comparisons •Why HAProxy? •Examples •Where it can be used? •Design consideration •How to implement •Benchmarking – Comparing metrics before implementing HAProxy and after implementation. [ Above point will be covered in next sessions  ]
  • 3. What is HAProxy? HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications ● Proxying ● Load balancing , Scale out, Failover ( Health Checks) ● High availability
  • 4. When to use? •Websites with very high loads. •Multiple connection to website. •Load Balancing required at HTTP and TCP level. •Fault Tolerance •Maximize Availability •Maximize throughput •Horizontal Scaling
  • 5. Who uses HAProxy? •Stack Overflow •Server Fault •GitHub •Tumblr •Twitter •Imgur – Image hosting / sharing •Instagram – Image hosting/sharing •Reddit …………. For more users, refer - http://www.haproxy.org/they-use-it.html
  • 6. Similar Products & comparisons •Nginx – Reverse proxy server , Load balancing , web server .. •Linux Virtual server – Runs in kernel mode, routes packets. - "fast as hell", but rigid as the kernel •Asp.Net WebFarm •AWS Elastic Load Balancer – Works with AWS or servers under AWS VPC. •F5 – Commercial •Varnish – Primarily focused on HTTP •……………….
  • 7. Why HAProxy? Out of band health checks – Monitors server health by sending requests at configured intervals which are independent of incoming traffic Works on TCP More Algorithm option – Support more number of algorithm to select backend server. Open Source product. Speed. It’s really, really fast. Hot reconfiguration – Don’t need to put in maintenance mode and change config.
  • 8. Examples •Load balance all png, jpg, gif requests to a specific server(s). •Load balance all mov, avi, mkv requests to a specific server(s). •Load balance users in South East US IP range to southeast.yoursite.com •Proxying users by ranking (gold customers, silver, bronze).
  • 9. Where it can be used? •Linux 2.4 on x86, x86_64, Alpha, Sparc, MIPS, PARISC •Linux 2.6 / 3.x on x86, x86_64, ARM, Sparc, PPC64 •Solaris 8/9 on UltraSPARC 2 and 3 •Solaris 10 on Opteron and UltraSPARC •FreeBSD 4.10 - 10 on x86 •OpenBSD 3.1 to -current on i386, amd64, macppc, alpha, sparc64 and VAX (check the ports) •AIX 5.1 - 5.3 on Power™ architecture
  • 10. Design consideration Need to segregate DB Server from App Server.
  • 11. Design consideration (Contd.) Clustering DB server. • All applications access the cluster via one single IP. The topology of the database cluster is masked behind HAProxy. • MySQL Connections are load-balanced between available DB nodes • It is possible to add or remove database nodes without any changes to the applications. • Once the max number of database connections (in MySQL) is reached, HAProxy queues additional new connections. This is a neat way of throttling database connection requests and achieves overload protection. Managing sessions: ◦ Set up sticky session in HAProxy ◦ Use centralized session management like Redis, Memcache
  • 12. How to implement Download and install HAProxy. Jump to config file and set following ◦ Access control list ◦ Bankend ◦ Frontend Few Algorithm for selecting back-end server. • Roundrobin - selects servers in turns. This is the default algorithm. • Leastconn - Selects the server with the least number of connections--it is recommended for longer sessions. • Source- This selects which server to use based on a hash of the source IP i.e. your user's IP address. This is one method to ensure that a user will connect to the same server.
  • 14. How to implement (Contd.) Load balancers are generally grouped into two categories: Layer 4 and Layer 7. Layer 4 load balancers act upon data found in network and transport layer protocols (IP, TCP, FTP, UDP). Layer 7 load balancers distribute requests based upon data found in application layer protocols such as HTTP. Node.Js App – HTTP Listener for different ports. HAProxy to make reverse proxy for port – 80 to others listed above. DEMO Browser Console Monitoring via Nagios, Scout
  • 15. Benchmarking Will be covered in next session.