Creating an HTTP Load Balancer in Python

Learn how the internals of a load balancer work!

This course explores a critical part of network infrastructure -- an HTTP load balancer.

In this course, you'll learn how to implement a load balancer in Python using Test-Driven Development (TDD). This course is aimed at full-stack developers, DevOps engineers, and enthusiasts interested in taking a deep drive into how Load Balancers work and their different features.

Learning Objectives

By the end of this course, you will be able to:

  1. Explain what a load balancer is and why it's needed in network infrastructure
  2. Describe the differences between host and path-based routing
  3. Implement host and path-based routing with Flask
  4. Practice Test-Driven Development
  5. Explain why health checks are necessary for load balancing and implement them
  6. Manipulate HTTP requests via the HTTP headers, URL parameters, and the URLs themselves
  7. Discuss and implement various load balancing algorithms for maximizing resiliency
  8. Add IP and path blocking to the load balancer so it can be used as a firewall

Tools and Technologies

  1. Python
  2. Flask
  3. pytest
  4. Docker
  5. Requests


To get the most out of this course, you should preferably have strong working knowledge of Python 3.

You should also have a solid understanding of the following Internet and web fundamentals:

  1. IP addresses, URL structures, and DNS
  2. Web browsers and web servers
  3. HTTP requests and responses

It is helpful to know the following but by no means compulsory:

  1. Intermediate level understanding of how the TCP and HTTP protocol work.
  2. Intermediate level Python.
  3. Beginner level understanding of Docker.
  4. Beginner level understanding of Makefiles.

Review the following videos for more info:

  1. The Kids Guide to the Internet
  2. What is the Internet?
  3. The Internet: IP Addresses & DNS
  4. The Internet: HTTP & HTML


  • Current version: 1.0.0
  • Last updated: December 7th, 2020
  • AuthorNeeran Gul

Table of Contents

Join our mailing list to be notified about course updates and new tutorials.