Skip to content

What Are Microservices?

Microservices are a modern interpretation of service-oriented architectures used to build distributed software systems. Services in a microservice architecture are processes that communicate with each other over the network in order to fulfill a goal. Microservices are a new realisation and implementation approach to SOA, which have become popular since 2014, and which also emphasize continuous deployment and other agile practices.

Microservices are essentially independent software services that provide specific business functionality in a software application. These services can be maintained, monitored and deployed independently.

Microservices are built on top of services oriented architecture.

Each microservice is loosely coupled with other services. These services are self-contained and serve a single functionality (or a group of common functionalities).

We will always be required to maintain and update software. We need to make it easier to enhance our applications and shorten the amount of time it takes to expose new versions of our applications.

There is no single commonly agreed definition of microservices.

Defining Characteristics of Microservices

  • Each service is a light-weight, independent, and loosely-coupled business unit.
  • Each service has its own codebase, managed and developed by a small team (mostly in an agile environment).
  • Each service is responsible for a single part of the functionality (business capability), and does it well.
  • Each service can pick the best technology stack for its use cases (no need to stick into one framework throughout the entire application).
  • Each service has its own DevOp plan (test, release, deploy, scale, integrate, and maintain independently).
  • Each service is deployed in a self-contained environment.
  • Services communicate with each other by using well-defined APIs (smart endpoints) and simple protocols like REST over HTTP (dumb pipes).
  • Each service is responsible for persisting its own data and keeping external state (Only if multiple services consume the same data, such situations are handled in a common data layer).

Fictitious e-commerce application

Let’s imagine that you are building an e-commerce application that takes orders from customers, verifies inventory and available credit, and ships them. The application consists of several components including the StoreFrontUI, which implements the user interface, along with some backend services for checking credit, maintaining inventory and shipping orders. The application consists of a set of services.


Full sized image

Tip

Your initial microservices macro-architecture conversations need to focus on precisely what you need to get started and then figure out how to get that into place. Build some services, observe their behaviors, and learn from what is and is not working for you.

Advantages

  • Application Scaling
    Firstly, Microservices are often Stateless and if they are carefully deployed using Docker, Kubernetes or using other Infrastructures, Microservices can offer horizontal Scaling within seconds. In fact, it is the high horizontal Scaling which leads companies like Netflix, Spotify, Uber, Google to move from Monolithic to Microservice Architecture. Secondly, if one microservice is e.g. CPU intensive, it could be implemented in a CPU optimized programming language (C/C++, Rust) where other microservices can be implemented in an interpreted language (Java, PHP).
  • Development Speed
    Microservices are often quite small in size (several hundred to several thousand). Due to the size, adding new features in Microservices are usually faster.
  • Development Scaling
    Microservices are autonomous and can be developed independently. As a result, Developer Scalability is much better as different developers/teams can work on different microservices autonomously without bumping into each other’s code. So, companies can easily hire more developers and can scale development. Similarly, due to their sizes, Microservices puts small cognitive load on newly hired Developers or fresh graduates and new Developers can normally write productive codes in a matter of days instead of weeks or months.
  • Release Cycle
    The coolest features of Microservice Architecture is that every Microservice is independently deployable. As a result, the Software Release Cycle in Microservice Applications is much smaller and with CI/CD, it is possible to give several releases per day. Core to the concept of microservices is the ability to build and execute tests in a very fast manner. Every commit to the microservice should result in a tested build. Once the tests pass and the build system is happy, a push button or an automatic deployment to production is the next important aspect.
  • Modernization
    As Microservices are loosely coupled and only communicate via language-agnostic way with each other, a single Microservice can easily be replaced by a new one which can be developed using a new programming language and tech stack without affecting the whole system. Modernization in Microservice Architecture is incremental and not Big Bang.

Further reading