Load Balancing Flashcards

1
Q

What is load balancer?

A

Definition:
A server mainly used as request dispatcher/router
mainly:
1.Distribute incoming client requests to computing resources(application servers /databases).
2.Returns the response from the computing resource to the appropriate client.

Load balancers can be implemented with hardware (expensive) or with software such as HAProxy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Load balancer Trade-offs

A

Advs:

  1. Auto failover
  2. distribute load accordingly
  3. eliminate server SPF -> increase availability/reliability

Disadvantage(s)

  1. can become a performance bottleneck
    a. when not enough resources
    b. not configured properly
  2. Can be the SPF -> using multiple increase complexity
  3. even using 1 increased complexity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Load Balancing algorithms?

When to use which?

A

Load balancers can route traffic based on various metrics, including:

  1. Random
  2. Least loaded
  3. Sticky Session/cookies - all future request for the same session are send to the same server
  4. Round robin or weighted round robin
  5. Layer 4
  6. Layer 7
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Layer 4 And Layer 7 load Balancing

A

Layer 4 load balancing

Layer 4 load balancers look at info at the transport layer to decide how to distribute requests. Generally, this involves the source, destination IP addresses, and ports in the header, but not the contents of the packet. Layer 4 load balancers forward network packets to and from the upstream server, performing Network Address Translation (NAT).

Layer 7 load balancing

Layer 7 load balancers look at the application layer to decide how to distribute requests. This can involve contents of the header, message, and cookies. Layer 7 load balancers terminates network traffic, reads the message, makes a load-balancing decision, then opens a connection to the selected server. For example, a layer 7 load balancer can direct video traffic to servers that host videos while directing more sensitive user billing traffic to security-hardened servers.

At the cost of flexibility, layer 4 load balancing requires less time and computing resources than Layer 7, although the performance impact can be minimal on modern commodity hardware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Differences Between Forward Proxy and Reverse Proxy

A

Forward proxy is used by the client such as a web browser whereas reverse proxy is used by the server such as a web server.

Forward proxy can reside in the same internal network as the client, or it can be on the Internet.

Forward proxy can be used by the client to bypass firewall restrictions in order to visit websites that are blocked by school, government, company etc. If a website blocked an IP range from visiting the website, then a person in that IP range can use forward proxy to hide the real IP of the client so that person can visit the website and maybe leave some spam comments.

Forward proxy can also act as a cache server in an internal network. If a resource is download many times, then the proxy can cache the content on the server so next time when another computer download the same content, the proxy will send the content that is previously stored on the server to the computer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Reverse proxy (web server)

A
  1. Is a web server that
  2. centralizes internal services
  3. provides unified interfaces to the public.

Requests from clients are forwarded to a server that can fulfill it before the reverse proxy returns the server’s response to the client.

Additional benefits include:

  1. Increased security - Hide information about backend servers, blacklist IPs, limit number of connections per client
  2. Increased scalability and flexibility - Clients only see the reverse proxy’s IP, allowing you to scale servers or change their configuration
  3. SSL termination - Decrypt incoming requests and encrypt server responses so backend servers do not have to perform these potentially expensive operations
    Removes the need to install X.509 certificates on each server
  4. Compression - Compress server responses
  5. Caching - Return the response for cached requests
  6. Static content - Serve static content directly
    HTML/CSS/JS
    Photos
    Videos
    Etc

Disadvantage(s): reverse proxy

  1. increase complexity
  2. using 1 can be SPF, using more can increase complexity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Load balancer vs reverse proxy

A
  1. Deploying a load balancer is useful when you have multiple servers. Often, load balancers route traffic to a set of servers serving the same function.
  2. Reverse proxies can be useful even with just one web server or application server, opening up the benefits described in the previous section.
  3. Solutions such as NGINX and HAProxy can support both layer 7 reverse proxying and load balancing.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly