Sie sind auf Seite 1von 26

Rohit Rahi

Load Balancing
Level 100 March 2018

Copyright © 2019, Oracle and/or its Copyright


affiliates.© All rights
2019, reserved.
Oracle 1 reserved.
and/or its affiliates. All rights
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 2


Objectives

After completing this lesson, you should be able to:


• Describe Oracle Cloud Infrastructure Load Balancing Service concepts
• Create and test a Public Load Balancer

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 3


Load Balancing Primer
A load balancer sits between the clients and the backends performs tasks such as:
• Service Discovery: What backends are available in the system? How should the load
balancer talk to them? Load
• Health Check: What backends are currently healthy and available to accept requests? Balancer
• Load Balancing: What algorithm should be used to balance individual requests across the
healthy backends?

Load Balancer benefits


• Fault tolerance and HA: using health check + LB algorithms, a LB can effectively route
around a bad or overloaded backend
• Scale: LB maximizes throughput, minimizes response time, and avoids overload of any
single resource
• Naming abstraction: name resolution can be delegated to the LB; backends don’t need
public IP addresses

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 4


OCI Load Balancing Service
• Load Balancer as-a-service, provides scale and HA
• Public and Private Load Balancer options
• Public Load Balancer service is regional in scope and provides High Availability across
two ADs
• Supported Protocols – TCP, HTTP/1.0, HTTP/1.1, HTTP/2, WebSocket
• Supports SSL Termination, End-to-End SSL, SSL Tunneling
• Supports advanced features such as session persistence and content based routing
• Key differentiators
– Private or Public Load Balancer (with Public IP address)
– Provisioned bandwidth – 100 Mbps, 400 Mbps, 8 Gbps
– Single load balancer for TCP (layer 4) and HTTP (layer 7) traffic

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 5


Public Load Balancer

• Accepts traffic from the internet using a public IP address that serves as the entry point for incoming traffic
• Public Load Balancer is a regional service.
• If your region includes multiple availability domains, a public load balancer requires either a regional subnet
(recommended) or two availability domain-specific (AD-specific) subnets, each in a separate availability domain.
• Load Balancing service creates a primary load balancer and a standby load balancer, each in a different availability
domain
• Supports AD failover in the event of an AD outage in an Oracle Cloud Infrastructure multi-AD region
• Floating Public IP is attached to the primary load balancer, and in the event of an AD outage Floating Public IP is
attached to the standby load balancer
• Service treats the two load balancers as equivalent and you cannot denote one as "primary”

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 6


Public Load Balancer (Using Regional Subnets - recommended)

VCN AVAILABILITY DOMAIN-1 AVAILABILITY DOMAIN-2

Public IP address

Listener

Load Balancer Load Balancer Pair Load Balancer


(Active) (Failover)
Regional Subnet 1

Backend Set
Backend Servers Backend Servers
Regional Subnet 2

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 7


Public Load Balancer (Using AD Specific Subnets)

VCN AVAILABILITY DOMAIN-1 AVAILABILITY DOMAIN-2

Public IP address

Listener

Load Balancer Load Balancer Pair Load Balancer


(Active) (Failover)
SUBNET 1 SUBNET 2

Backend Set
Backend Servers Backend Servers
SUBNET 3

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 8


Private Load Balancer

• Assigned a private IP address from the subnet hosting the LB


• The load balancer can be regional or AD-specific, depending on the scope of the host subnet; highly-available within
an AD with AD specific subnets or Highly available with regional subnets
• The primary and standby load balancer each require a private IP address from that subnet
• The load balancer is accessible only from within the VCN that contains the associated subnet, or as further restricted
by your security list rules

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 9


Private Load Balancer (Using Regional Subnets)
Local VCN
AVAILABILITY DOMAIN-1 traffic AVAILABILITY DOMAIN-2
VCN

Private IP address

Listener

Load Balancer Load Balancer Pair Load Balancer


(Active) (Failover)
Regional Subnet 1

Backend Set
Backend Servers Backend Servers
Regional Subnet 2

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 10


Private Load Balancer (with AD Specific Subnets)

VCN AVAILABILITY DOMAIN-1 AVAILABILITY DOMAIN-2

Listener

(Failover) Local VCN


Load Balancer
(Active)
traffic
SUBNET 1

Backend Set
Backend Servers Backend Servers
Regional Subnet 2

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 11


Concepts - Public Load Balancer
• Load Balancing Policy – tells the load
VCN AVAILABILITY DOMAIN-1 AVAILABILITY DOMAIN-2
balancer how to distribute incoming traffic to
the backend servers
• round-robin
Public IP address • IP hash
• least connection
Listener
• Backend Server – application server
Load Balancer Load Balancer Pair Load Balancer responsible for generating content in reply to
(Active) (Failover) the incoming TCP or HTTP traffic
Regional Subnet 1
• Health Checks – a test to confirm the
availability of backend servers; supports
• TCP-level
• HTTP-level health checks
Backend Set • Backend Set – logical entity defined by a list
Backend Servers Backend Servers of backend servers, a load balancing policy,
Regional Subnet 2 and a health check policy
• Listener – entity that checks for incoming
traffic on the load balancer's IP address

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 12


Load Balancing Policies
• Round Robin: default policy, distributes incoming traffic sequentially to each server in a backend set.
After each server has received a connection, the load balancer repeats the list in the same order.
• IP Hash: uses an incoming request's source IP address as a hashing key to route non-sticky traffic to
the same backend server
• Least Connection: routes incoming non-sticky request traffic to the backend server with the fewest
active connections
• Load balancer policy decisions apply differently to TCP load balancer, cookie-based session persistent
HTTP requests (sticky requests), and non-sticky HTTP requests
– A TCP load balancer considers policy and weight criteria
– An HTTP load balancer w/ cookie-based session persistence forwards requests using cookie's
session info
– For non-sticky HTTP requests, the load balancer applies policy and weight criteria

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 13


Health Check
• Health check is a test to confirm the availability of backend servers. Health Check is activated for
• Backends
• Backend set
• Overall Load Balancer
• A load balancer IP can have up to 16 listeners (port numbers). Each listener has a backend set that
can have 1 to N backend servers

Server 1

Backend set
Load
Listener Server 2
Balancer IP

Server 3
Listener

• Health API provides a 4-state health status (ok, warning, critical, unknown)
• Health status is updated every three minutes. No finer granularity is available

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 14


Steps to create a Public Load Balancer

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 15


1: Create VCN, a regional subnet and instances with web servers
Dest CIDR Route Target
0.0.0.0/0 IGW OCID

Availability Domain 1
Default Route Table

Default SL (+ port 80)

Internet
Gateway
Availability Domain 2

SUBNET A,
10.0.1.0/24

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 16


2: Create Load Balancer Route Table and Security List
Dest CIDR Route Target
LB SL (empty) LB Route Table 0.0.0.0/0 IGW OCID

Availability Domain 1

Internet
Gateway
Availability Domain 2

SUBNET A,
10.0.1.0/24

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 17


3: Create a regional Public Subnet for Load Balancer in your VCN
Dest CIDR Route Target
0.0.0.0/0 IGW OCID

Availability Domain 1

Internet
Gateway
Availability Domain 2

SUBNET B, SUBNET A,
10.0.2.0/24 10.0.1.0/24

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 18


4.1 Create the Public Load Balancer
Dest CIDR Route Target
0.0.0.0/0 IGW OCID

Availability Domain 1
LB
(Active)

Internet
Gateway
Availability Domain 2

SUBNET B, SUBNET A,
10.0.2.0/24 10.0.1.0/24

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 19


4.2 Add a backend set and add servers to backend set
• Add a Backend Set
– Name

Availability Domain 1
– Policy
– SSL
– Health Check
LB
(Active) • Add backend Servers to backend set
– Instance
– Port
Internet
Gateway – Weight
Availability Domain 2

Rules are NOT added to LB Security Lists


and backend server security lists
SUBNET B, SUBNET A,
automatically, the user has to manually open
10.0.2.0/24 10.0.1.0/24 them to allow traffic between them.

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 20


4.3 Add a Listener

• Add a Listener
– Name
Availability Domain 1 – Protocol, Port, SSL
– Backend Set
LB
(Active)

Listener
Internet
Availability Domain 2

Gateway

SUBNET B, SUBNET A,
10.0.2.0/24 10.0.1.0/24

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 21


Type CIDR Protocol Source Dest
5: LB SL and Backend SL Port Port
Egress 10.0.1.0/24 TCP All 80

Availability Domain 1
LB
(Active) Type CIDR Protocol Source Dest
Port Port
Ingress 10.0.2.0/24 TCP All 80
Egress 0.0.0.0/0 All All
Internet
Availability Domain 2

Gateway

SUBNET B, SUBNET A,
10.0.2.0/24 10.0.1.0/24

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 22


6: Allow traffic to Listener
Type CIDR Protocol Source Dest
Port Port
Ingress 0.0.0.0/0 TCP All 80

Availability Domain 1 Egress 10.0.1.0/24 TCP All 80

LB
(Active)

Listener
Internet
Availability Domain 2

Gateway

SUBNET B, SUBNET A,
10.0.2.0/24 10.0.1.0/24

VCN, 10.0.0.0/16

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 23


Pricing
OCI Load Balancer is priced as below

Metric Pay as You Go Monthly Flex

OCI - 100 Mbps Load Balancer Load Balancer Hour $0.0213 $0.0213

OCI - 400 Mbps Load Balancer Load Balancer Hour $0.0850 $0.0850
OCI - 8000 Mbps Load Balancer Load Balancer Hour $1.7 $1.7

There is no separate charge for any data handled at the Load Balancer tier

http://esource.oraclecorp.com/portal/page/portal/ROOTFOLDER/PRICE/PRICING_ENGINE/CURR_PRICE_LIST/ORACLE%20PAAS%20AND%20IAAS%2
0PUBLIC%20CLOUD%20GLOBAL%20PRICE%20LIST.PDF

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 24


Summary

• OCI Load Balancer provides automated traffic distribution from one entry point to multiple servers in
VCN; Improves resource utilization, facilitates scaling, and helps ensure high availability
• OCI Load Balancer is a regional service and supports Public or Private Load Balancers
• Supports multiple Protocols – TCP, HTTP/1.0, HTTP/1.1, HTTP/2, WebSocket
• Supports SSL Offloading – SSL Termination, End-to-End SSL, SSL Tunneling
• Supports session persistence and content based routing
• Key differentiators
– Private or Public Load Balancer (with Public IP address)
– Provisioned bandwidth – 100 Mbps, 400 Mbps, 8 Gbps
– Single load balancer for TCP (layer 4) and HTTP (layer 7) traffic

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 25


cloud.oracle.com/iaas

cloud.oracle.com/tryit

Copyright © 2019, Oracle and/or its affiliates. All rights reserved. 26

Das könnte Ihnen auch gefallen