Microservices with Docker

by Sysco LABS Articles 24 February 2017

In this Innovation Session, Dilan Arandara of the Data, Infrastructure & Platform team spoke about Microservices with Docker.

Before Microservices, developers used Monolithic Applications. What this meant was that developers had to deploy their code in a bundle. This method posed a few problems; a single change affects the whole component, massive time constraints, testing and frequent feature releases, being bound to a single technology stack, and difficult version updates. But today, where speed could be the difference between success and failure, this method would not work, requiring a different approach.

A solution was found – the breakdown of a single application into multiple components – and Microservices was born.

So, what is a Microservice? The standard definition is;

“Microservice is a specialization of an implementation approach for service-oriented architectures (SOA) used to build flexible, independently deployable software systems. Services in a microservice architecture (MSA) are processes that communicate with each other over a network in order to fulfill a goal”

The core areas that you should keep in mind with this definition are “specialization of an implementation”,build flexible”, “independently deployable”, and “communicate with each other over a network”.

The main advantages of Microservices are that it allows software releases to be made frequently, which in turn allows companies to adapt to trends fast.  Scaling is easier, it supports different technology stacks and testing becomes easier for two reasons. One reason is that a microservice can be independently tested. The second is that identifying a bug becomes a simpler task due to the same reason as stated above.

As always, with the pros, comes the cons. Microservice is not always the golden egg solution. Some of the drawbacks that you are likely to face when using microservices are, increase in network traffic, data consistency becomes hard to maintain, versioning becomes critical, and debugging becomes difficult due to the various components in the application.

Microservices has become very popular recently. A quick check on Google Trends shows how this trend has grown over time:

1Image Source : Google Trends. 2017. microservices – Google Trends. [ONLINE] Available at:

Advantages of Microservices

  • Independent Deployments

Small components which can be deployed separately. Feature and critical updates can be deployed without affecting other component/services. This allows large companies to make their application agile and robust.

  • Independently Scalable

Optimize the performance by scaling up/out each independent service separately. As a result, both performance and cost saving will increase seamlessly.

  • Different technology stacks

Each container can have different technology stacks, because every container does not share resources with other containers.

  • Small code bases

As microservice is a small component, developers need to only consider a small code base which have small services.


Things to Consider when dealing with Microservices

  • Increased Complexity

Due to a significant number of containers, complexity is increased. Thus, it has become substantially essential to think about server management, especially when it comes to monitoring. Moreover, we must ensure all containers are up and running. In addition, memory management, disk space management are some of the crucial things that need to be observed. However, cluster management and orchestration tools were developed to make the developers’ life easier.

  • Increased Network Chattiness

Microservices should communicate using web API, and it is considered a best practice. Therefore, network communication has become a crucial thing.

  • Data Consistency

Every microservice has its own state. Eventually, consistency and integrity challenges rise with decentralized data. Nevertheless, there are consistency and eventual consistency concepts. Furthermore, software design patterns such as event sourcing and notification services can be used to push data changes to a centralized location.

  • Fault Tolerance and Resiliency

As there are many microservices in between, faults can be more prevalent and more of a challenge.

  • Diagnostics

Due to vital number of microservices, there will be significant amount of logs. As a result, immense consideration must be given to log aggregation and analysis. And also, overall diagnostic and debugging can be challenging. Thus, it must be planned right at the beginning.

  • Versioning

As there are many applications, there will be numerous versions of microservices. Eventually, microservice consumers must be alert about new version releases of each and every microservice. However, there must be proper versioning technique to which every consumer must agree.

  • Deployment

Due to the large number of microservices, developers need to consider how to deploy a component, and how to deploy updates on each component.

Developers have to significantly think about the above mentioned issues. Although there were promised benefits of traditional servers and virtual machines, they were not the best for microservices.


Why Containers for Microservices?

Container is an operator system level virtualization method for running multiple isolated systems on a controlled host using a single kernal.

Containers are substantially light weight than traditional servers and virtual machines. Moreover, each container has its own root file system, processes, memory and network interface.


Server Architecture of Microservices

Why Docker?

In 2008 cgroups were introduced to the Linux kernel. Cgroups limit and account for the resource usage of a set of operating system processes. The Linux kernel uses namespace to isolate the system resources of processes from each other. Docker took the advantage of this. Underlying Linux kernel features that Docker uses are cgroups and namespaces.

Docker is a platform for developing, shipping, and running applications using container virtualization technology.

Docker Core Platform Products

  • Docker Engine

Lightweight and powerful open source containerization technology combined with a work flow for building and containerizing applications.

  • Docker Hub

A cloud-based registry service which allows to link code repositories, build images and test them, stores manually pushed images, and links to Docker Cloud, which allows the deployment of images to any host.

  • Docker Machine

A tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands.

  • Docker Swarm

A clustering and scheduling tool for Docker containers. With Swarm, IT administrators and developers can establish and manage a cluster of Docker nodes as a single virtual system.

  • Docker Compose

A tool for defining and running multi-container Docker applications.

  • Kitematic

Run containers through a simple, powerful graphical user interface.


A sample docker project is created under:

Leave a Comment