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

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.

Just a word of thanks for doing such a great job with these training courses. The thorough, entire-lifecycle approach -- from implementation through test, coverage, quality, CI/CD, and all the rest -- is what separates these courses from other training material that I've completed. I'll be able to walk away from here with knowledge and skills that I can apply immediately at work -- and for that I'm grateful. It's a rare gift in an environment where so much 'training' is really just lightweight treatment that doesn't begin to scratch the surface of real, end-to-end software development. Really well done!

The TestDriven.io courses are worth 10 times what I paid for them.

I'm writing to thank you for all the tutorials and the work you've put out there. I'm new to DevOps and I found TestDriven.io while looking for Django and DevOps related topics. One of the best collections of tutorials and guides I've seen -- very well-written, clear, and concise. You have saved me so much time and energy. Thanks from the bottom of my heart.

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.