Creating an HTTP Load Balancer in Python

  • Updated December 7th, 2020
  • v1.0.0
Neeran Gul Neeran Gul

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.

What will you learn?

Select a Part

  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
  1. Discuss and implement various load balancing algorithms for maximizing resiliency
  2. Add IP and path blocking to the load balancer so it can be used as a firewall

What do you need to know?

This course is targeted at advanced-beginners -- someone with at least 6 months of web development experience. Before beginning, along with having strong working knowledge of Python 3, you should have some familiarity with the following topics:

Internet and Web Fundamentals

You should 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

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

Helpful to Know

It's 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.

Meet the Author

Neeran Gul

Neeran Gul

Neeran is a Site Reliability Engineer (SRE) who lives in London, United Kingdom. He's currently an SRE at BenevolentAI where he leads the SRE team. He enjoys technical writing and architecting cloud infrastructure. In his free time he loves to cycle in the countryside and promote open source projects.

What developers are saying

Test-Driven Development with FastAPI and Docker is a great course. We're using almost the exact same stack at work for a new project, so the course has provided me with a lot of immediate value. It's hard to find resources like it that cleanly bring in all of the working pieces without dragging on forever.

The Test-Driven Development with FastAPI and Docker course sets the foundations on how to develop a robust application by using test-driven design. It condenses in one resource what you can find in bits and pieces scattered around the web. The advantages of taking this course are that you don't have to glue several pieces together but you can have a cohesive view of the project. Recommended for people who don't want to waste time and start coding right away with solid foundations.

The Test-Driven Development with FastAPI and Docker course has really nice pacing and progression. I'm grateful to be able to learn about FastAPI with Docker as well as TDD since it's been intimidating for me.

The TestDriven.io courses are some of the best courses I've ever done for any language, any platform, any price range... just some of the most thorough and well-sourced courses around.

I am very much into buying and purchasing any course by you and your team. I've never felt like a better programmer ready to show my coding chops to the world.

Frequently Asked Questions

What tools and technologies are used in this course?

This course covers the follow technologies:

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

What support does TestDriven.io offer?

Since the courses mimic real-world development, support is provided via Stack Overflow. Helpful users, including the developers of the courses, read and respond to messages on Stack Overflow. If you get stuck and you can't find an answer via Stack Overflow, feel free to reach out via email directly. Just be sure to detail what you've tried. For more, review Support and Consulting.

How long does it take to complete the course?

It's dependent on your current skill level. On average, it takes approximately 7 hours to complete.