Book Image

Docker High Performance

By : Allan Espinosa
Book Image

Docker High Performance

By: Allan Espinosa

Overview of this book

<p>Docker is a portable container format that allows you to run code anywhere from your desktop to the cloud. The workflow around Docker makes development, testing, and deployment much easier and much faster. However, it’s essential that you know the best practices most techniques for optimization so Docker can help you deploy your application most effectively.</p> <p>This comprehensive guide will improve your Docker workflows and will ensure your application’s production environment runs smoothly. It starts with a short refresher on working with Docker, then you will learn how to take this basic knowledge to the next level by optimizing your Docker infrastructure and applications at scale. At the end of the book, we will put the concepts and everything you have learned about Docker’s features into practice by rolling out supplementary monitoring and troubleshooting instrumentation to your infrastructure. All of these things will ensure your application succeeds using Docker.</p>
Table of Contents (15 chapters)
Docker High Performance
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preparing a Docker host farm


A key component in load balancing our Docker application is to have a farm of servers to send our application's requests to. In the case of our infrastructure, this involves preparing a farm of Docker hosts to deploy our application to. The scalable way to do this is to have a common base configuration that is managed by configuration management software, such as Chef, as we previously covered in Chapter 3, Automating Docker Deployments with Chef.

After preparing the farm of Docker hosts, it is time to prepare the application that we will run. In this chapter, we will scale a simple NodeJS application. The rest of this section will describe how this application works.

The web application is a small NodeJS application written in a file called app.js. For the purpose of visualizing how our application load balances, we will also log some information about our application and the Docker host it is running in. The app.js file will contain the following code:

var http...