DEV Community

Priyanshi Sharma
Priyanshi Sharma

Posted on • Updated on

What are Microservices: The Pros and Cons

Alt Text

Microservice Architecture or Microservices are increasingly being used in the software industry to create large and complex applications. It is an approach where a single application comprises several loosely coupled and independently deployable services. The trend of using microservices has grown over the years as organizations want to become agile while moving towards continuous testing and DevOps.

Let’s understand the concept of microservices in detail.

Monolithic and Microservices Architecture

To understand what microservices are and what they are offering, it is important to acknowledge its predecessor monolithic architecture.

Traditionally, software developers used to create a large application using monolithic architecture. Monolithic refers to composing the entire software application having different components into a single program. It can be said that monolithic architecture is like a huge container that concludes all the components of the software into a single package. And as the size of the application increases so does the complexity of the architecture. This makes the changes in the application slow as it affects the entire application. Simply put, even a small modification in the code might require building and deploying an entirely new version of the application and scaling a part of the application means scaling the entire application.

To solve this problem microservices have come into view. The core objective of a microservice architecture is to make the application design, development and maintenance simpler by breaking them into smaller pieces where each module supports a certain goal and use a well-defined interface to communicate with other services.

Unlike monolithic architecture, each service in the microservice architecture has its own database, programming language, frameworks, containers, and so on which makes the development process easier and more efficient. They are highly maintainable, testable, independently deployable, organized around business capabilities and each related service is owned by a small, separate team.

How Microservices Work?

Microservices are a collection of services that work together to make a complete application operable. This architecture uses APIs to share information, such as queries or a stream of data from one service to another.

The way an underlying application works or which hardware that service is built upon solely depends on the team who builds the software. Due to this, the communication between teams and upgrading services very dynamic and reactive that enables developers to be more resilient in the development process.

With the rise of cloud computing and network computers, the need of owning a powerful computer to run necessary operations has eliminated and it has placed the responsibility to run the services whenever a user runs the application on the servers.

In microservices, the user’s machine can be responsible for basic processing but its main purpose is to send and receive data from the network on the computer.

Whenever a consumer uses an application, it can be assumed that there are few more software or hardware resources turned on to empower your experience. However, in the case of Uber, Instagram or Facebook, it may be reasonable to expect at least 10,000 other active resources that enhance the user experience.

Microservices are basically considered as an evolution of SOA or Service Oriented Architecture, but there are clear differences between them.

Pros & Cons of Microservices

With microservices, a development team can acquire a boost in the development process while enabling them to develop multiple microservices simultaneously. But it is not just limited to that, here is the list of some other benefits that microservices offer:

Pros of Microservices

  • With the x-axis and z-axis scaling, each microservice can be scaled independently of the others. To accomplish this, multiple copies of the containerized application and databases across the server are used.
  • It offers better fault tolerance. As the services in a microservice architecture are independent, they do not impact each other. It means even in the case of a service failure, the rest of the application will run usually.
  • With the smaller pieces of services, it becomes easier for the developers to understand, update, and augment the services that result in faster deployment as well.
  • As the development cycle is abbreviated, a microservice architecture backs agile updates, deployment, and development of the application.
  • With the polyglot APIs, developers can easily choose the best technologies and language for the functionality they are working on.
  • Different services can be coded using different languages.
  • It can be developed by smaller development teams
  • Microservices provide easier integration and deployment using continuous integration tools like Hudson and Jenkins.
  • While changing a certain part of the application, only the related services will be modified and redeployed instead of the entire application.
  • Easy to integrate and scale with third party services

Just like any other architecture, microservices are not a silver bullet, it also has a few cons that you need to consider before using them for application development.

Cons of Microservices

  • Having distributed deployment can make testing tedious and complicated.
  • With the increase in the number of services, integration and management of the products become complex.
  • It can result in information barriers.
  • Efforts will be spent on implementing a communication interface between services.
  • Use cases that span more than one service are tough and require cooperation among different teams.

Now that you know what microservice is, what are its benefits, pros and cons, you can easily decide whether or not you want to use microservices for your next project or not. If you are a developer yourself then it's time you start learning about microservices as sooner or later you might have to work using this architecture. However, if you are a business owner wanting to develop an application, then you can hire developers with in-depth knowledge and experience in the architecture you want your application in.

Source: Decipher

Discussion (6)

mwrpwr profile image
Joseph Maurer

Thanks for pointing out such an interesting trend Priyanshi! I honestly didn't even know that Micro-services was a thing. I can see how if the services were to span multiple teams, the implementation could get really difficult. Thanks for sharing!

p0lish profile image

My opinion is:

A good microservice architecture can evolve from a good monolith. Its seriously hard job to develop a complex application with microservices from the start. There are so many changes during the design and development. Monolith first then split into services.

andykaiser profile image
Andy Kaiser

Great post. 👏👏 IMHO microservice architecture is a must for future proof products. But monolithic is still an option for fast prototyping and in some specific cases. But most importantly, before choosing any solution analysing the pros and cons for the proposed architecture is a must!

ethan11lee profile image

Lately, only a dumb person has not been talking about microservices. This is becoming more and more popular. The modular architectural style seems particularly well suited to cloud environments and is growing in popularity. Thank you for sharing interesting information. I have also seen many other microservices examples.

victorhtorres profile image
Víctor H. Torres

Great post!

rohithv07 profile image
Rohith V

Good Post..