Load Balancing in Google Cloud Platform Flashcards
what does cloud load balancer
It distributes user (incoming traffic) traffic across instances of an application in single region or multiple regions (across multiple vm instancess ? which belong to instance group). It is fully distributed software defined managed service
Important features of Load Balancer
- health check (route to healthy instances)
- auto scaling
- single anycast IP (this IP can be used to receive traffic from multiple regions ~ serve global traffic using this IP)
- supports internal load balancing (for applications deployed within specific network)
load balancer enables
high availability
auto scaling
resiliency
(creates very loosely coupled architecture)
protocols and layers of communication
application - layer 7 -> http https smtp
transport - layer 4 -> tcp tls udp
network - layer 3 -> ip
about layers
network layer - transfer bits and bytes
transport layer - ensures that bits and bytes are transferred properly
application layer - sends mails, makes rest api calls
Each layer makes use of the layers beneath it (http uses tcp&ip)
Why do we have layers of communication
Network layer - IP - Internet Protocol, transfers bits&bytes is unreliable
Transport Layer
- TCP - Transmission Control - Reliability > Performance
- TLS - Secure TCP - data is encrypted
- UDP - User Datagram Protocol - Performance > Reliability (example video streaming, needs to be fast, but some of the data can be lost)
Application Layer
- HTTP - Hypertext Transfer Protocol - Stateless Request Response Cycle
- HTTPS - secure HTTP - uses certificates which are installed on servers
- SMTP - Email Transfer Protocol
- FTP - File Transfer Protocol
Do all application communicate at application layer
for high performance applications can skip application layer and directly talk on transport layer
STIGLA DO 60
What are different types of load balancers you can create in gsp network services
http (http, https)
tcp (or applications that use tcp/ssl : tcp, ssl proxy, tcp proxy)
udp (for applications that use udp protocol)
each can be internet facing or internal lb
http&tcp can be multiple&single region
udp can only be single region
What do we need to configure for load balancer
Frontend (protocol ip adress and port, ephemeral/static). If you use ssl, certificate has to be assigned to lb
Beckend (group of endpoints which receive traffic from load balancer - example instance groups instance group or multiple ? instances)
Host and Path Rules (how to send/distribute traffic to backends ??? specific for http/s load balancers. Rules can be based on host, path, headers, method (get, post..)
What is ssl/tls termination/offloading
This means that secure communication is terminated on load balancer as it is not needed through googles internal network
Client to Load Balancer https/tls
Load Balancer to vm instance http/tcp
(If you are using ssl you are communicating over layer 7 using https)
The advantage of using termination/offloading is reducing the load on vm instances, that do not need to handle security just process request
Instance template
defines how instance vm should look, it can use custom image
LB scenario:
What should you configure if you want only healthy instances to receive traffic
configure health check on the lb? on the managed instance group ? VMs
LB scenario:
You want high availability for your VM instances
Create multiple MIG (managed instance groups) for VM instances in multiple regions and distribute load using LB across them
LB scenario:
You want to route requests to multiple microservices using same load balancer
Create individual MIGs (managed instance groups) and backends for each microservice. Create Host and path rules to redirect to specific microservice backend based on the path (/mircoservice-a, /microservice-b ….). You can route to a backend Cloud Storage bucket as well.
Which LB to chose if you want to load balance global external https traffic across backend instances, across multiple regions
Chose external HTTP(S) Load Balancer