Book Image

Docker High Performance. - Second Edition

By : Allan Espinosa, Russ McKendrick
Book Image

Docker High Performance. - Second Edition

By: Allan Espinosa, Russ McKendrick

Overview of this book

Docker is an enterprise-grade container platform that allows you to build and deploy your apps. Its portable format lets you run your code right from your desktop workstations to popular cloud computing providers. This comprehensive guide will improve your Docker work?ows and ensure your application's production environment runs smoothly. This book starts with a refresher on setting up and running Docker and details the basic setup for creating a Docker Swarm cluster. You will then learn how to automate this cluster by using the Chef server and cookbooks. After that, you will run the Docker monitoring system with Prometheus and Grafana, and deploy the ELK stack. You will also learn best practices for optimizing Docker images. After deploying containers with the help of Jenkins, you will then move on to a tutorial on using Apache JMeter to analyze your application's performance. You will learn how to use Docker Swarm and NGINX to load-balance your application, and how common debugging tools in Linux can be used to troubleshoot Docker containers. By the end of this book, you will be able to integrate all the optimizations that you have learned and put everything into practice in your applications.
Table of Contents (16 chapters)
Title Page
Copyright and Credits
About Packt

Preparing application backends

To create a load balanced application, we must first prepare the application where it is served by several replicas in our Docker Swarm service. In the following steps, we will deploy an application that is scaled in our Docker Swarm cluster:

  1. First, we will provision additional nodes in our Docker Swarm cluster. This is to make sure we have enough capacity in our cluster to scale out our application later. In the following output, we can see that we have four nodes available:
dockerhost$ docker node ls
9tcxzq45 * dockerhost Ready  Active     Leader       18.09.3
thxcn7ev   node-5lfg  Ready  Active                  18.09.0
7lyr93qf   node-ftc0  Ready  Active                  18.09.0
oydrnufp   node-hqvv  Ready  Active                  18.09.0
  1. Next, we will prepare a simple Node.js application in a file called app.js. The following app logs additional information related on how our application is...