A Simple Introduction to Microservices
Today, the technological landscape changes fast, new languages, frameworks, and solutions are appearing in an unprecedented pace. Users expect businesses to deliver value fast and frequently. Applications with traditional monolithic architecture can not cope with the challenges of the rapidly changing market conditions. In this article, we provide an introduction to fundamentals of Microservices, which is a software architecture style more ideal for the development of scalable cloud-based software applications.
What are microservices?
Microservices are the opposite of the traditional monolithic architectural style. Monolithic applications are based on a client-server and developed as a large single unit, where a single server-side application handles the database manipulation, HTTP requests, and all the computing tasks. The code bases of different functionalities are highly interconnected therefore even a small modification can make integration very complex and turn deployment into a minefield of risks. Scalability of monolithic applications is often inefficient since the entire application needs to be scaled not only the parts which are in demand.
Microservices, otherwise known as microservice architectural style, are an application development method that divides the application into small well-defined distinctive services. Microservices are distributed across networks and communicate with each other via technology independent protocols. It has come to existence as an evolution of service-oriented architectures after the DevOps philosophy has become more widespread.
Note: Modularity is encouraged in other development methods as well. Monolithic structures also use shared modules and libraries. Microservices, however, making the boundaries more obvious and harder to breach.
Characteristics of Microservices
The main characteristics of microservice architectural style are defined by the principles of loose coupling and high cohesion of services:
- Applications are made up of small independent services.
- Functionalities of the application are distributed among different services.
- Services are independent of each other, separate pieces of code.
- Services are small complete units of functionality.
- Services are independently modifiable and (re)deployable.
- Services communicate through well-defined technology agnostic protocols such as REST (HTTP protocol) or RPC (using it’s own TCP protocol)
- Logic related to a particular service should be kept in a single place.
- Microservices based system architecture and continuous deployment is a match made in heaven.
- Decentralized data management: each service can have its own database.
Advantages of Microservices
- Developing a microservice does not require a big team.
- Each service of the application can be modified independently.
- Developing, modifying, and deploying a service does not affect the operation of another service.
- Does not require a long-term commitment to a certain type of technology.
- Allows flexible use of languages, frameworks, and databases within the same application
- Decreased risk attached to deployment, smoother operation, and fewer customer complaints.
- Easy to implement continuous deployment.
- Latest technologies can be adopted quickly
- Fault isolations: the crash of microservice does not make the entire application crash.
- Efficiently scalable:
- Only those services need to be scaled that are in demand.
- Load balancing.
- Easy to use with Docker (and other container technologies).
- Does not require big design efforts upfront.
- Enables flexible product evolution.
- Facilitates early release and continuous iteration.
- Allows quick time-to-market and Agile development.
- Easy to integrate with third party services and tools.
Disadvantages of Microservices
- Expensive remote calls (instead of in-process calls).
- Increased network latency.
- Increased processing time.
- Bug tracking can be tedious.
- Information barriers and communication difficulties
- Developing a use case could need the cooperation of multiple teams.
- Developers can struggle to see the big picture.
- Moving responsibilities between services are difficult and complex.
- Communication between multiple teams can cause decreased productivity.
- Duplication of efforts and replication of functionalities.
- Moving an engineer to new team could be problematic if they use a different stack
Examples of Services based on Microservices
flow.ci is a hosted continuous integration and delivery service, designed for teams who need a flexible and scalable solution but prefer not to maintain their own infrastructure. In flow.ci, development pipelines or automation workflows are simply called flows. In a flow, every step is a plugin that can be added by two clicks. You can add as many steps to your flow as you need, and there is no time limit on builds.