Thiago P.

Database Load Balancing and Performance Methods

Written in Systems, Databases

← back to the notes


Round Robin

Send a request to each server in a consistent order and then back around

s1, s2, s3, s1, s2, s3, s1, ...

Round Robin Problems

Round Robin Solutions

Least Connections

Send the request to the server with the least connections

Still has the issue of user session persistence

Agent Based

Each server reports on its current load and the request is sent to the server with least load

Fail Over

All requests are sent to one server, and when that server is full, then they are all sent to the next server, and so on

IP Hash

The clients IP address is hashed and the hash determines which server to send the request to

 

The 5 9s of uptime

  1. 99% uptime
  2. 99.9% uptime
  3. 99.99% uptime
  4. 99.99% uptime
  5. 99.999% uptime (good luck with that)

Sharding vs Partitioning (in terms of DBs)

Partitioning is the dividing up of your data into separate units

Sharding is horizontal partitioning (partitioning across multiple machines)

Positives

Negatives

 

Bonus - GZIP (GNU ZIP)

Method of compressing data before sending it to the client.

Useful for text files with lots of repeating words/phrases such as HTML, CSS, or JS, but not so good for image or video files which may already be optimized.

 

The browser automatically decides whether or not to accept zipped files by sending the "Accept-Encoding: gzip, deflate" header