Recorded Webinar

Load Balancing Strategies with NGINX/HAProxy and Consul

Learn how to use NGINX and HAProxy for load balancing microservice applications with HashiCorp Consul and then see how you can move beyond load balancing altogether using network middleware like Consul.

Speakers

Since its first release in 2014, HashiCorp Consul has evolved from an open-source tool that provides service discovery, health checking, load balancing, and a globally distributed key-value store to pioneering microservice networking with service mesh capabilities. Since then, the Consul team has released first-class integrations with Kubernetes, Envoy, AWS Cloudmap, and more. However, before considering full-fledged service mesh, many companies looking to adopting microservices architectures are still struggling to come up with an optimized load balancing approach with their existing networking architecture.

How can you optimize your load balancing strategy with Consul?

When multiple instances of the same service are running simultaneously, how do you balance traffic to all healthy instances of the service while handling changes in health status, changes in the instances as they scale up and down, and changes in the instances distributed across multiple clusters?

In this webinar, HashiCorp solutions engineer Christoph Puhl will show a few strategies and technologies for load balancing microservice applications with Consul and how to move beyond load balancing altogether using network middleware like Consul. 1. Using Consul's service discovery and native load balancing via dynamic routing to remove the need for some load balancers. 2. Using NGINX or HAProxy load balancers to balance traffic with Consul Template to manage the configuration. 3. Using NGINX or HAProxy load balancers to balance traffic while integrated to and automated by Consul's native service discovery.

Outline

0:00 — Introduction to Consul's core use cases in modern dynamic infrastructures

4:24 — Consul service discovery and native load balancing via dynamic routing

9:52 — Demo: Running NGINX with Consul Template

17:14 — Demo: Consul native service discovery integration for HAProxy with "server-template" feature

28:31 — Q&A

Q&A

  • If we're using Consul for service discovery of Kubernetes services and it is using a NodePort (so each service will have a random 3xxxx port each time it restarts), will the HAProxy server-template be able to discover against those ports (since they can't be pre-configured), or would consul-template be the better choice?

  • In a multi-datacenter use case, does Consul take the latency between datacenters into account to reduce traffic between datacenters?

  • Is Consul only for cloud services? We are running a mixture of on-prem, AWS, Azure. and Kubernetes

  • Is it possible to pass values for NGINX directives via Consul?

  • Does Consul have any kind of integration with Terraform?

  • How do you avoid an HAProxy startup 'service down' situation when using SRV templates?

  • What sort of scale can Consul run at? Is it possible to run on hundreds of systems?

  • Is Consul free software?

  • How does Consul handle services that are registered in Kubernetes? How can they be discovered from VMs running outside of Kubernetes?

  • For multi-datacenter, would you need a cluster for each datacenter? Or can Consul cluster itself and be distributed amongst datacenters. If so, would this be a good idea or not regarding latency?

  • What volume of services and how rapidly can they be changed before the Consul cluster begins to have performance issues?

  • Is there a good guide for Consul performance scaling?

  • We are building an application that will generate many many small services, and we will start and stop them rapidly. What issues should we be aware of?

Additional resources

More resources like this one

  • 3/15/2023
  • Case Study

Using Consul Dataplane on Kubernetes to implement service mesh at an Adfinis client

  • 1/20/2023
  • FAQ

Introduction to Zero Trust Security

  • 1/4/2023
  • Presentation

A New Architecture for Simplified Service Mesh Deployments in Consul

  • 12/31/2022
  • Presentation

Canary Deployments with Consul Service Mesh on K8s