Best Practices for Load Balancing Docker Containers

Containers are rapidly becoming the go-to software tool for application developers, and Docker is one of the most-loved container platforms according to the latest Stack Overflow developer survey. Docker simplifies software development so that developers can build applications that are lightweight, easily scalable and can run on any infrastructure. But when it comes to management and orchestration, the platform needs to be augmented with modern load balancing to ensure that business-critical applications are always up, fast and secure.

For a quick refresher on containerization, a container is “a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another,” according to Docker.

So, what’s the difference between containers and Docker containers, you might ask? Docker containers run on Docker Engine, a container runtime that powers millions of applications.

Optimized Load Balancing for Docker Containers

Docker provides many developer tools, including Swarm: Docker’s open source container orchestration platform. Like Kubernetes or Rancher, Swarm supports high availability and load balancing. But these capabilities are very basic and not sophisticated enough to fully protect your business-critical applications.

Here are the best practices we recommend for load balancing Docker containers with a modern Application Delivery Controller (ADC).

Support for Automated Service Discovery

Service discovery is an essential feature of container environments because it enables dynamic application scaling. Containers can be automatically discovered, along with their health status, so that traffic can be redirected instantly to optimize application performance. Because it’s automated, the process is much faster than manual configurations.

Your ADC should support automated service discovery, otherwise you will go right back to using manual processes to connect your ADCs to your containers, and to scale your ADCs as your container use goes up or down. Use an ADC that supports DNS-based service discovery using Service (SRV) records for IP, port and weight.

For example, Snapt Nova uses the data from the container platforms to scale dynamically and uses service discovery to find backends. It understands your apps and when the backends are failing or struggling and reacts automatically.

Service Mesh Awareness

Cloud-native applications that are composed of microservices and run across containers need a service mesh, which is a separate, dedicated infrastructure layer that handles vital service-to-service communication for containerized microservices. Since applications are broken down into independent, loosely coupled microservices running in dynamic container environments, it is imperative that the services communicate with each other without impacting application performance. Examples of service meshes include Istio and Linkerd, which are both open source technologies.

In a containerized environment, your ADC must have robust east-west load balancing capabilities as well as awareness of and integration with the service mesh layer, so that it can provide load balancing between microservices and containers.

For example, Nova integrates with Envoy, which is a distributed proxy for service mesh. Nova is capable of high-performance east-west load balancing.

Observability, Management and Scalability

Once deployed into your container environment, your ADC must provide detailed Layer 7 telemetry, such as latency and HTTP error rates, that is easy to access and act upon so that you always know traffic conditions and how your apps are performing at any given time. In addition, you also need to easily manage your ADC instances. In a large-scale containerized deployment, you are likely to have tens, hundreds or even thousands of ADCs, where it would be difficult or impossible to manage them all individually.

You need access to centralized application analytics and reporting, as well as centralized management of your ADCs, including the ability to deploy additional ADC nodes. This requires a centralized platform for ADC control and automation, with the ability to scale out and scale in on demand.

For example, Nova ADCs are served dynamically from Nova's centralized, scalable, multi-location Cloud Controller, which provides centralized observability and management for your ADCs.

Web Acceleration and Security

In addition to load balancing, an ADC that is designed for cloud-native, containerized applications should also provide web acceleration and web application firewall (WAF) features, which are missing ingredients in container orchestration platforms like Docker Swarm.

To speed up the performance of your applications, your ADC’s acceleration tools should include object caching, which automatically stores and manages static content in memory to reply faster to clients. Also, the processing of SSL encryption can be offloaded from your web servers, which accelerates web site performance and is more secure.

Your ADC should protect your network and your customers against attacks like Denial of Service (DoS), brute force and web scraping, just to name a few. Your ADC should take a pro-active approach to analyzing traffic patterns and server behaviour to detect and defeat threats as they arise.

For example, Nova uses machine learning to profile all ADC nodes and the servers behind them to understand their baseline behavior, so that it can identify an anomaly and knows when to raise an alarm. It uses artificial intelligence (AI) to analyse traffic on a large scale to predict threats and challenges even before they fully manifest, so you can stay ahead of the next problem.

Conclusion

Docker users need load balancing that is compatible with containers. This means automated service discovery, service mesh awareness, and observability and management that can operate at hyperscale. When planning your strategy for application delivery in Docker containers, choose an ADC that will support you in these areas.

Nova is a next-generation ADC that was designed for cloud native-applications, microservices and containers to meet the needs of DevOps teams today and in the future. As the most modern, scalable ADC, it also has a fit-for-purpose, Software-as-a-Service (SaaS) pricing model so that you only pay for what you need.

To try the latest in ADC technology, get started with the free Nova Community Edition.

Get the Snapt Nova Community Edition

Subscribe Here!