SlideShare a Scribd company logo
1 of 30
Server Load Balancer
1
2
Introduction
● More users, more resources needed
○ CPU, RAM, HDD …
● Scale Up & Scale Out
○ One powerful server to service more users; or
○ Multiple servers to service more users
● Pros & Cons ?
● C10K / C100K Problem
3
Introduction
● High Availability
○ A characteristic of a system, which aims to ensure an agreed level of
operational performance, usually uptime, for a higher than normal
period.
● Availability (per year)
○ 99%: 3.65days
○ 99.9%: 8.77 hours (3 nines)
○ 99.99%: 52.60 minutes (4 nines)
○ 99.999%: 5.26 minutes (5 nines)
4
High Availability
● Principles
○ Elimination of single points of failure.
○ Reliable crossover.
■ Reliable configuration / topology change
○ Detection of failures as they occur.
● Graceful Degradation
○ the ability of a computer, machine, electronic system or network to
maintain limited functionality even when a large portion of it has
been destroyed or rendered inoperative.
Single point of failure - Wikipedia
5
Load Balancing
● Client Side
○ e.g: DNS round-robin
○ Pros & Cons
● Server Side
○ Server Load Balancer
6
Server Load Balancer (1)
● Provide “Scale-Out” and HA features
● Share loading among all backend nodes with some algorithms
○ Static Algorithms: does not take into account the state of the system
for the distribution of tasks.
○ Dynamic Algorithms
7
Server Load Balancer (2)
● Layer 4 or Layer 7
○ Layer 4 Switch
● Distribution Algorithms
○ Round-robin
○ Random
○ Ratio
○ Hash Table
○ Least-connections
○ Persistence
■ Session-ID (e.g. HTTP Cookie)
8
Server Load Balancer (3)
● Persistence (Stickiness)
○ "The Server" in OLG
○ How to handle information that must be kept across the multiple
requests in a user's session.
● Session ID?
○ Cookie
○ IP Address
○ TCP Connection
● Pros & Cons ?
9
Server Load Balancer (4)
● SSL offloading (SSL/TLS termination)
○ Pros?
● Problems of Server Load Balancer
○ SPoF
○ Capacity Limit
○ Latency
10
HW & SW of Server Load Balancer
● Nginx
● Ingress in K8S
● PF in FreeBSD
● haproxy
● Envoy Proxy
● F5 BIG-IP
● A10
● on Cloud
○ AWS ELB (Elastic Load Balancer)
○ Google CLB (Cloud Load Balancer)
11
Global Server Load Balancer (GSLB)
● Globally balancing traffic to the nearest node.
● Pros
○ (Speed of light)
● Cons ?
● Technology
○ GeoDNS
■ resolve IP address based by the
location of clients
○ Anycast
■ use BGP
■ Google DNS 8.8.8.8
12
Haproxy
● http://www.haproxy.org
● Reliable & High Performance TCP/HTTP Load Balancer
○ Layer 4 (TCP) and Layer 7 (HTTP) load balancing
○ SSL/TLS termination
○ Gzip compression
○ Health checking
○ HTTP/2
13
Haproxy - Installation
● In FreeBSD:
○ pkg install haproxy
○ You can also build it from ports
○ Config file: /usr/local/etc/haproxy.conf
14
Haproxy - Configuration
global
daemon
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
tune.ssl.default-dh-param 2048
defaults
log global
retries 3
maxconn 2000
timeout connect 5s
timeout client 50s
timeout server 50s
listen stats
bind 127.0.0.1:9090
balance
mode http
stat enable
stat auth admin:admin
15
Haproxy - Configuration
frontend www_csie_nctu
bind 140.113.208.102:80
mode http
use_backend www_csie_nctu_server
frontend cscc_csie_nctu
bind 140.113.208.103:80
mode http
use_backend www_csie_nctu_server
frontend game_server
bind 140.113.208.104:9876
mode tcp
backend www_csie_nctu_server
balance roundrobin
mode http
http-request set-header X-forwarded-Port %[dst_port]
http-request set-header X-forwarded-Proto https if { ssl_fc }
server www1 192.168.99.1:80
server www1 192.168.99.2:80
16
Haproxy - Configuration
backend cscc_csie_nctu_server
balance roundrobin
mode http
option httpchk HEAD /health_check.php HTTP/1.1rnHost: cscc.cs.nctu.edu.tw
option forwardfor
http-request set-header X-forwarded-Port %[dst_port]
http-request set-header X-forwarded-Proto https if { ssl_fc }
server www1 192.168.99.101:80 check fall 3 rise 2
server www1 192.168.99.102:80 check fall 3 rise 2
17
Haproxy Configuration
● global
○ log
○ chroot
○ uid / gid
○ pidfile
18
Haproxy Configuration
● defaults
○ log
○ option
○ retries
○ timeout
19
Haproxy Configuration
● listen
○ stats
20
Haproxy Configuration
● frontend
○ bind
○ mode
○ option
○ use_backend
21
Haproxy Configuration
● backend
○ balance
■ roundrobin, leastconn, hdr(param)
○ mode
○ http-request
○ server
■ check
■ fall
■ rise
■ inter
■ cookie
22
Haproxy - run
● /etc/rc.conf.local
○ haproxy_enable="YES"
● /usr/local/etc/rc.d/haproxy start
● Question: how to setup a backup node for haproxy?
23
Haproxy - Reference
http://cbonte.github.io/haproxy-dconv/2.1/configuration.html
24
Envoy
● https://www.envoyproxy.io
● Developed by Lyft (a ride-sharing company like Uber) and
opensourced in 2017
○ Apache License 2.0
● Features
○ Dynamic APIs for configuration
○ Service Discovery
○ gRPC / MongoDB / HTTP support
● MicroService
25
Envoy - Installation
● Broken in FreeBSD now (require BoringSSL)
○ You can install it on Linux instead
● https://www.getenvoy.io
○ Debian: https://www.getenvoy.io/install/envoy/debian/
○ Ubuntu: https://www.getenvoy.io/install/envoy/ubuntu/
○ Centos: https://www.getenvoy.io/install/envoy/centos/
26
Envoy - Configuration
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 127.0.0.1, port_value: 10000 }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type":
type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManag
er
stat_prefix: ingress_http
codec_type: AUTO
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/" }
route: { cluster: some_service }
http_filters:
- name: envoy.filters.http.router
Examples — envoy 1.18.0-dev-fce386 documentation (envoyproxy.io)
27
Envoy - Configuration
clusters:
- name: some_service
connect_timeout: 0.25s
type: STATIC
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: some_service
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 1234
Examples — envoy 1.18.0-dev-fce386 documentation (envoyproxy.io)
28
Envoy - Configuration
● YAML file format
● Basic concept is same as haproxy
○ Listen (frontend) address
○ Backend addresses
○ Healthy Checks
■ https://www.envoyproxy.io/learn/health-check
○ Routes
29
Envoy - Run
● envoy -c config.yaml
30
Envoy - Reference
● https://www.envoyproxy.io/docs/envoy/latest/
● https://blog.getambassador.io/envoy-vs-nginx-vs-haproxy-why-the-open-source-ambassador-api-
gateway-chose-envoy-23826aed79ef

More Related Content

Similar to haproxy_Load_Balancer.pptx

Improving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberImproving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberYing Zheng
 
OpenStackTage Cologne - OpenStack at 99.999% availability with Ceph
OpenStackTage Cologne - OpenStack at 99.999% availability with CephOpenStackTage Cologne - OpenStack at 99.999% availability with Ceph
OpenStackTage Cologne - OpenStack at 99.999% availability with CephDanny Al-Gaaf
 
Large scale overlay networks with ovn: problems and solutions
Large scale overlay networks with ovn: problems and solutionsLarge scale overlay networks with ovn: problems and solutions
Large scale overlay networks with ovn: problems and solutionsHan Zhou
 
DockerCon EU '17 - Dockerizing Aurea
DockerCon EU '17 - Dockerizing AureaDockerCon EU '17 - Dockerizing Aurea
DockerCon EU '17 - Dockerizing AureaŁukasz Piątkowski
 
Scaling Redis: Dmitry Polyakovsky
Scaling Redis: Dmitry PolyakovskyScaling Redis: Dmitry Polyakovsky
Scaling Redis: Dmitry PolyakovskyRedis Labs
 
OpenTelemetry For Operators
OpenTelemetry For OperatorsOpenTelemetry For Operators
OpenTelemetry For OperatorsKevin Brockhoff
 
Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014bryan_call
 
Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibrePablo Moretti
 
Web performance mercadolibre - ECI 2013
Web performance   mercadolibre - ECI 2013Web performance   mercadolibre - ECI 2013
Web performance mercadolibre - ECI 2013Santiago Aimetta
 
Experiences building a distributed shared log on RADOS - Noah Watkins
Experiences building a distributed shared log on RADOS - Noah WatkinsExperiences building a distributed shared log on RADOS - Noah Watkins
Experiences building a distributed shared log on RADOS - Noah WatkinsCeph Community
 
Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018Orit Wasserman
 
ChinaNetCloud Training - HAProxy Intro
ChinaNetCloud Training - HAProxy IntroChinaNetCloud Training - HAProxy Intro
ChinaNetCloud Training - HAProxy IntroChinaNetCloud
 
Mux loves Clickhouse. By Adam Brown, Mux founder
Mux loves Clickhouse. By Adam Brown, Mux founderMux loves Clickhouse. By Adam Brown, Mux founder
Mux loves Clickhouse. By Adam Brown, Mux founderAltinity Ltd
 
University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)Mike Belshe
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloudOVHcloud
 
A Kong retrospective: from 0.10 to 0.13
A Kong retrospective: from 0.10 to 0.13A Kong retrospective: from 0.10 to 0.13
A Kong retrospective: from 0.10 to 0.13Thibault Charbonnier
 

Similar to haproxy_Load_Balancer.pptx (20)

Improving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberImproving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at Uber
 
OpenStackTage Cologne - OpenStack at 99.999% availability with Ceph
OpenStackTage Cologne - OpenStack at 99.999% availability with CephOpenStackTage Cologne - OpenStack at 99.999% availability with Ceph
OpenStackTage Cologne - OpenStack at 99.999% availability with Ceph
 
Large scale overlay networks with ovn: problems and solutions
Large scale overlay networks with ovn: problems and solutionsLarge scale overlay networks with ovn: problems and solutions
Large scale overlay networks with ovn: problems and solutions
 
DockerCon EU '17 - Dockerizing Aurea
DockerCon EU '17 - Dockerizing AureaDockerCon EU '17 - Dockerizing Aurea
DockerCon EU '17 - Dockerizing Aurea
 
Scaling Redis: Dmitry Polyakovsky
Scaling Redis: Dmitry PolyakovskyScaling Redis: Dmitry Polyakovsky
Scaling Redis: Dmitry Polyakovsky
 
How to monitor NGINX
How to monitor NGINXHow to monitor NGINX
How to monitor NGINX
 
Discoblocks.pptx.pdf
Discoblocks.pptx.pdfDiscoblocks.pptx.pdf
Discoblocks.pptx.pdf
 
OpenTelemetry For Operators
OpenTelemetry For OperatorsOpenTelemetry For Operators
OpenTelemetry For Operators
 
Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014
 
Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibre
 
Web performance mercadolibre - ECI 2013
Web performance   mercadolibre - ECI 2013Web performance   mercadolibre - ECI 2013
Web performance mercadolibre - ECI 2013
 
Experiences building a distributed shared log on RADOS - Noah Watkins
Experiences building a distributed shared log on RADOS - Noah WatkinsExperiences building a distributed shared log on RADOS - Noah Watkins
Experiences building a distributed shared log on RADOS - Noah Watkins
 
Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018
 
ChinaNetCloud Training - HAProxy Intro
ChinaNetCloud Training - HAProxy IntroChinaNetCloud Training - HAProxy Intro
ChinaNetCloud Training - HAProxy Intro
 
Mux loves Clickhouse. By Adam Brown, Mux founder
Mux loves Clickhouse. By Adam Brown, Mux founderMux loves Clickhouse. By Adam Brown, Mux founder
Mux loves Clickhouse. By Adam Brown, Mux founder
 
University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)University of Delaware - Improving Web Protocols (early SPDY talk)
University of Delaware - Improving Web Protocols (early SPDY talk)
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloud
 
PHP at Density and Scale
PHP at Density and ScalePHP at Density and Scale
PHP at Density and Scale
 
PHP at Density and Scale
PHP at Density and ScalePHP at Density and Scale
PHP at Density and Scale
 
A Kong retrospective: from 0.10 to 0.13
A Kong retrospective: from 0.10 to 0.13A Kong retrospective: from 0.10 to 0.13
A Kong retrospective: from 0.10 to 0.13
 

Recently uploaded

FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escortsindian call girls near you
 
象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdf
象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdf象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdf
象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdfkeithzhangding
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 

Recently uploaded (20)

FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
 
象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdf
象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdf象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdf
象限策略:Google Workspace 与 Microsoft 365 对业务的影响 .pdf
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 

haproxy_Load_Balancer.pptx

  • 2. 2 Introduction ● More users, more resources needed ○ CPU, RAM, HDD … ● Scale Up & Scale Out ○ One powerful server to service more users; or ○ Multiple servers to service more users ● Pros & Cons ? ● C10K / C100K Problem
  • 3. 3 Introduction ● High Availability ○ A characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher than normal period. ● Availability (per year) ○ 99%: 3.65days ○ 99.9%: 8.77 hours (3 nines) ○ 99.99%: 52.60 minutes (4 nines) ○ 99.999%: 5.26 minutes (5 nines)
  • 4. 4 High Availability ● Principles ○ Elimination of single points of failure. ○ Reliable crossover. ■ Reliable configuration / topology change ○ Detection of failures as they occur. ● Graceful Degradation ○ the ability of a computer, machine, electronic system or network to maintain limited functionality even when a large portion of it has been destroyed or rendered inoperative. Single point of failure - Wikipedia
  • 5. 5 Load Balancing ● Client Side ○ e.g: DNS round-robin ○ Pros & Cons ● Server Side ○ Server Load Balancer
  • 6. 6 Server Load Balancer (1) ● Provide “Scale-Out” and HA features ● Share loading among all backend nodes with some algorithms ○ Static Algorithms: does not take into account the state of the system for the distribution of tasks. ○ Dynamic Algorithms
  • 7. 7 Server Load Balancer (2) ● Layer 4 or Layer 7 ○ Layer 4 Switch ● Distribution Algorithms ○ Round-robin ○ Random ○ Ratio ○ Hash Table ○ Least-connections ○ Persistence ■ Session-ID (e.g. HTTP Cookie)
  • 8. 8 Server Load Balancer (3) ● Persistence (Stickiness) ○ "The Server" in OLG ○ How to handle information that must be kept across the multiple requests in a user's session. ● Session ID? ○ Cookie ○ IP Address ○ TCP Connection ● Pros & Cons ?
  • 9. 9 Server Load Balancer (4) ● SSL offloading (SSL/TLS termination) ○ Pros? ● Problems of Server Load Balancer ○ SPoF ○ Capacity Limit ○ Latency
  • 10. 10 HW & SW of Server Load Balancer ● Nginx ● Ingress in K8S ● PF in FreeBSD ● haproxy ● Envoy Proxy ● F5 BIG-IP ● A10 ● on Cloud ○ AWS ELB (Elastic Load Balancer) ○ Google CLB (Cloud Load Balancer)
  • 11. 11 Global Server Load Balancer (GSLB) ● Globally balancing traffic to the nearest node. ● Pros ○ (Speed of light) ● Cons ? ● Technology ○ GeoDNS ■ resolve IP address based by the location of clients ○ Anycast ■ use BGP ■ Google DNS 8.8.8.8
  • 12. 12 Haproxy ● http://www.haproxy.org ● Reliable & High Performance TCP/HTTP Load Balancer ○ Layer 4 (TCP) and Layer 7 (HTTP) load balancing ○ SSL/TLS termination ○ Gzip compression ○ Health checking ○ HTTP/2
  • 13. 13 Haproxy - Installation ● In FreeBSD: ○ pkg install haproxy ○ You can also build it from ports ○ Config file: /usr/local/etc/haproxy.conf
  • 14. 14 Haproxy - Configuration global daemon log 127.0.0.1 local0 log 127.0.0.1 local1 notice maxconn 4096 tune.ssl.default-dh-param 2048 defaults log global retries 3 maxconn 2000 timeout connect 5s timeout client 50s timeout server 50s listen stats bind 127.0.0.1:9090 balance mode http stat enable stat auth admin:admin
  • 15. 15 Haproxy - Configuration frontend www_csie_nctu bind 140.113.208.102:80 mode http use_backend www_csie_nctu_server frontend cscc_csie_nctu bind 140.113.208.103:80 mode http use_backend www_csie_nctu_server frontend game_server bind 140.113.208.104:9876 mode tcp backend www_csie_nctu_server balance roundrobin mode http http-request set-header X-forwarded-Port %[dst_port] http-request set-header X-forwarded-Proto https if { ssl_fc } server www1 192.168.99.1:80 server www1 192.168.99.2:80
  • 16. 16 Haproxy - Configuration backend cscc_csie_nctu_server balance roundrobin mode http option httpchk HEAD /health_check.php HTTP/1.1rnHost: cscc.cs.nctu.edu.tw option forwardfor http-request set-header X-forwarded-Port %[dst_port] http-request set-header X-forwarded-Proto https if { ssl_fc } server www1 192.168.99.101:80 check fall 3 rise 2 server www1 192.168.99.102:80 check fall 3 rise 2
  • 17. 17 Haproxy Configuration ● global ○ log ○ chroot ○ uid / gid ○ pidfile
  • 18. 18 Haproxy Configuration ● defaults ○ log ○ option ○ retries ○ timeout
  • 20. 20 Haproxy Configuration ● frontend ○ bind ○ mode ○ option ○ use_backend
  • 21. 21 Haproxy Configuration ● backend ○ balance ■ roundrobin, leastconn, hdr(param) ○ mode ○ http-request ○ server ■ check ■ fall ■ rise ■ inter ■ cookie
  • 22. 22 Haproxy - run ● /etc/rc.conf.local ○ haproxy_enable="YES" ● /usr/local/etc/rc.d/haproxy start ● Question: how to setup a backup node for haproxy?
  • 24. 24 Envoy ● https://www.envoyproxy.io ● Developed by Lyft (a ride-sharing company like Uber) and opensourced in 2017 ○ Apache License 2.0 ● Features ○ Dynamic APIs for configuration ○ Service Discovery ○ gRPC / MongoDB / HTTP support ● MicroService
  • 25. 25 Envoy - Installation ● Broken in FreeBSD now (require BoringSSL) ○ You can install it on Linux instead ● https://www.getenvoy.io ○ Debian: https://www.getenvoy.io/install/envoy/debian/ ○ Ubuntu: https://www.getenvoy.io/install/envoy/ubuntu/ ○ Centos: https://www.getenvoy.io/install/envoy/centos/
  • 26. 26 Envoy - Configuration static_resources: listeners: - name: listener_0 address: socket_address: { address: 127.0.0.1, port_value: 10000 } filter_chains: - filters: - name: envoy.filters.network.http_connection_manager typed_config: "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManag er stat_prefix: ingress_http codec_type: AUTO route_config: name: local_route virtual_hosts: - name: local_service domains: ["*"] routes: - match: { prefix: "/" } route: { cluster: some_service } http_filters: - name: envoy.filters.http.router Examples — envoy 1.18.0-dev-fce386 documentation (envoyproxy.io)
  • 27. 27 Envoy - Configuration clusters: - name: some_service connect_timeout: 0.25s type: STATIC lb_policy: ROUND_ROBIN load_assignment: cluster_name: some_service endpoints: - lb_endpoints: - endpoint: address: socket_address: address: 127.0.0.1 port_value: 1234 Examples — envoy 1.18.0-dev-fce386 documentation (envoyproxy.io)
  • 28. 28 Envoy - Configuration ● YAML file format ● Basic concept is same as haproxy ○ Listen (frontend) address ○ Backend addresses ○ Healthy Checks ■ https://www.envoyproxy.io/learn/health-check ○ Routes
  • 29. 29 Envoy - Run ● envoy -c config.yaml
  • 30. 30 Envoy - Reference ● https://www.envoyproxy.io/docs/envoy/latest/ ● https://blog.getambassador.io/envoy-vs-nginx-vs-haproxy-why-the-open-source-ambassador-api- gateway-chose-envoy-23826aed79ef