DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Key Takeaways: Adrian Cockcroft's talk on Netflix, CD, and Microservices
  • Mainframe Modernization Acceleration Through OpenShift
  • Microservice Architecture and Agile Teams
  • How Your Application Architecture Has Evolved

Trending

  • Understanding IEEE 802.11(Wi-Fi) Encryption and Authentication: Write Your Own Custom Packet Sniffer
  • Integration Isn’t a Task — It’s an Architectural Discipline
  • AI-Driven Root Cause Analysis in SRE: Enhancing Incident Resolution
  • How to Build Real-Time BI Systems: Architecture, Code, and Best Practices
  1. DZone
  2. Culture and Methodologies
  3. Agile
  4. What Are Microservices?

What Are Microservices?

Learn the ins and out of microservice design.

By 
Tomas Fernandez user avatar
Tomas Fernandez
·
Jun. 21, 22 · Analysis
Likes (9)
Comment
Save
Tweet
Share
11.1K Views

Join the DZone community and get the full member experience.

Join For Free

Beloved by tech giants like Netflix and Amazon, microservices have become the new darlings in modern software development, even though they are more than a decade old. But, despite the benefits, this paradigm is easy to get wrong. So, let's explore what microservices are and, more importantly, what they are not.

What Are Microservices?

The microservice architecture is a software design approach that decomposes an application into small independent services that communicate over well-defined APIs. Since each service can be developed and maintained by autonomous teams, it is the most scalable method for software development.

Microservices vs. Monoliths

Microservice design is the polar opposite of monolith development. A monolith is one big codebase ("the kitchen sink") that implements all functionalities. Everything is in one place, and no single component can work in isolation. This means that the application must be tested as a whole.

On the plus side, monoliths are easy to get up and running. Airbnb, to give an example, started with "The Monorail," a Ruby on Rails monolith. While the company was still small, developers could iterate fast. Making broad changes was easy as the relationships between the different parts of the monolith were transparent.

As a company grows and teams increase in size, however, monolith development becomes more difficult. Soon, the system can no longer fit in a single head — there are just too many moving parts, so things slow down.

Microservices vs. monolith


Microservices allow companies to keep teams small and agile. The idea is to decompose the application into small services that can be autonomously developed and deployed by tightly-knitted teams.

Benefits of Microservices

Scalability

The main reason that companies adopt microservices is scalability. Services can be developed and released independently without arranging large-scale coordination efforts within the organization.

Fault Isolation

A benefit of having a distributed system is the ability to avoid single failure points. You can deploy microservices in different availability zones with cloud-enabled technologies, ensuring that your users never experience an outage.

Smaller Teams

With microservices, the development team can stay small and cohesive. The smaller the group, the less communication overhead and the better the collaboration.

Amazon takes team size to the extreme with their two-pizza teams. Meaning that a team should be small enough to be fed by two pizzas.

The Freedom to Choose the Tech Stack

With a monolith, language and tech stack options are pretty much set from the beginning. New developers must adapt to whatever choices were made in the past.

In contrast, each microservice can use the tech stack that is most appropriate for solving the task at hand. Thus, the team can pick the best tool for the job and their skills. For example, you can implement a high-performing service in Go or C and a high-tolerance microservice with Erlang or Elixir.

More Frequent Releases

The development and testing cycle is shorter as small teams iterate quicker. And, because they can also deploy their updates at any time, microservices can be deployed much more frequently than a monolith.

Microservices Design Challenges

Microservice design properties


With so many benefits, it would seem that choosing microservices for a new project is a no-brainer. But microservice design also comes with some tough challenges:

  • Small: applies both to the team size and the codebase. A microservice must be small enough to be entirely understood by one person. Your microservice is too big if it would take you more than a sprint to rewrite it from scratch.

  • Focused on one thing: a service must focus on one aspect of the problem or perform only one task.

  • Autonomous: autonomy allows a team to choose the most appropriate language stack and data model. This usually means that each microservice has its own database or persistence layer that is not shared with other services.

  • Aligned with the bounded context: in software, we create models to represent the problem we want to solve. A bounded context represents the limits of a given model. Contexts are natural boundaries for services, so finding them is part of designing a good microservice architecture.

  • Loosely-coupled: while microservices can depend on other microservices, we must be careful about how they communicate. Each time a bounded context is crossed, some level of abstraction and translation is needed to prevent behavior changes in one service from affecting the others.

  • Independently deployable: being autonomous and loosely-coupled, a team can deploy their microservice with little external coordination or integration testing. Microservices should communicate over well-defined APIs and use translation layers to prevent behavior changes in one service from affecting the others.

When "Microservices" Are Not Microservices

How do you know if you're doing proper microservice design? If your team can deploy an update at any time without coordinating with other teams, and if other teams can similarly deploy their changes without affecting you, congratulations, you got the knack of microservices.

The surest way of losing the benefits microservices offer is by not respecting the decoupling rule. If we look closely, we see that microservices are all about autonomy. When this autonomy is lost, teams must coordinate during development and deployment. Perfect integration testing is required to make sure all microservices work together.

Even so, exhaustive testing cannot catch all problems. When something breaks, coupled services are hell to debug. And when the problem is found, fixing it isn't always as easy as rolling back an update.

Tight service dependencies create team dependencies


These are all problems that come with distributed computing. If you’ve ever used a cloud service, you’ll know that spreading services or machines over many geographical locations is not the same as running everything on the same site. A distributed system has a higher latency, can have synchronization issues, and is a lot harder to manage and debug. This highly-coupled service architecture is really, deep down, a distributed monolith, with the worst of both worlds and none of the benefits microservices should bring.

If you cannot deploy without coordinating with another team or relying on specific versions of other microservices to deploy yours, you're only distributing your monolith.

When Microservices Aren’t the Best Choice

Microservices have not replaced monoliths. Both are valid approaches. In fact, a monolith may be the best choice while the team is still discovering what they are building. 

A monolith can feel like a natural starting point for a project as it’s simple to develop, quick to iterate, fast to deploy, easy to debug, and more forgiving of design mistakes. Monoliths can take you far before scalability becomes an issue.

Are Microservices Right for You?

Microservices are the most scalable way we have to develop software. But they are not free lunches. They come with some risks that are easy to run afoul of if you're not cautious. They are great when the team is growing and you need to stay fast and agile. But you need to have a good understanding of the problem to solve, or you can end up with a distributed monolith.

agile microservice

Published at DZone with permission of Tomas Fernandez. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Key Takeaways: Adrian Cockcroft's talk on Netflix, CD, and Microservices
  • Mainframe Modernization Acceleration Through OpenShift
  • Microservice Architecture and Agile Teams
  • How Your Application Architecture Has Evolved

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!