Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Getting Off the Microservices Bandwagon

DZone's Guide to

Getting Off the Microservices Bandwagon

Are microservices really the only way to increase uptime and release velocity? Learn how a monolith can keep up with development without complicating QA.

· Microservices Zone ·
Free Resource

Containerized Microservices require new monitoring. Read the eBook that explores why a new APM approach is needed to even see containerized applications.

Netflix uses microservices. They deploy countless times a day without service interruptions. We should all do microservices. Really?

Microservices, designed well, increase fault tolerance and minimize the footprint any given release to production can have. What microservices do is isolate development and allow us to test against a constant size of code as we prepare a production release.

Monoliths, on the other hand, grow over time. Regression tests become larger and larger. Yelp, for example, had to build a custom distributed architecture so that their test coverage could keep up with development.

Focus on the Goal — Release Often, Release Fast

What we want is not microservices but an efficient way of releasing at a constant rate. Simply put, a traditional monolith will become more complicated as features are added. With each new feature development and QA will take more time. Let's say that for each new feature development effort for an additional feature will be 1.25x the effort. With each new feature, QA will be 1.5x the effort. This is obviously assuming that the complexity of the feature itself will be constant.

This never actually happens like this. Teams adjust, they hire more team members, they try to find something to improve their workflow, teams themselves work faster as they understand the product more etc.

But the key concern still exists: a feature's development time is a function not only of its inherent complexity but also of the size of the codebase into which it is introduced.

Microservices change this by keeping the code size into which a feature is introduced constant. Instead of adding a new feature into an ever large pile of code, we build a new separate service.

Complexity Is a Cost

Microservices allow us to develop in constant time, ensuring that we can deliver feature after feature without being overwhelmed by all the work we have already done. Our code can stay fresh, young, and vibrant.

But we have other concerns: traceability, monitoring, debugging. If a single inbound request will hit 2 or more services then tracing the request becomes a bigger challenge; consistent logging, helping us to investigate what happened, becomes a challenge; debugging a microservice architecture becomes a challenge; state management and caching become a challenge.

There are some answers: debugging shouldn't be a challenge. If the applications are well written, functionally compact, and follow a service contract we are ok...

Anyone who has ever written code knows that timelines, cost concerns, priorities etc. make the above very difficult to achieve in practice. As our service contracts expand we need to look at how to maintain backward compatibility — do we run two services v1 and v2 in tandem? Now monitoring and routing become a challenge as existing consumers probably did not specify a version. Feature creep can be a problem - most changes start out as a small addition to an existing functionality. Too often they are bloated and have their tentacles deeply embedded into the code before we notice this new functionality was actually a foreign invader.

But these are solvable problems for large teams with developers dedicated specifically to a service. But if you have just 20 developers developing 15 microservices to deliver an application this might not be a good strategy. The maintenance burden of orchestrating 15 microservices will be so large that it will probably absorb all the gains from reducing development time.

Focus on Objectives — Strike a Balance Based on Practical Realities

Let's say you want to build a set of services that expose the core functionality of your business. As you do a domain exploration you discover you will have 50+ services.

Your first step should not be to chase that microservices utopia. Look at how these services are composed and how susceptible they are to changes in the ecosystem. The ecosystem here is all the space that you must interact with but cannot control.

Second, look at your team composition. How big is your team? If you have 10 developers, j50 microservices with their individual development pipelines, repos, etc. may not be sustainable.

My suggestion: group services into parent groups, and into release velocity groups to discover the practical ideal for service granularity.

Parent Groups

Some services may justify individual domains but may also be grouped together - we may discover a parent domain that they all relate to. It may be worth considering publishing the parent domain as a single service to reduce orchestration and maintenance burden.

Release Velocity

This one is harder to gauge, but generally speaking, services that power UI layers (highly dynamic ecosystem) will need to be updated and changed more frequently than services that deal with backend core systems (near static ecosystem). When we are looking at services where we control the upstream and downstream pieces fairly completely we can justify building larger services that have longer release cycles. Services that need to be nimble to enable the latest user capabilities may require to stay small so as to embrace the next trend quickly.

These two ways of grouping our domains should help us understand our service granularity. What we will end up is some set of services that act almost like small monoliths, many small to medium-sized services, and a few microservices that truly share nothing.

When approaching architecture we should not focus on catchphrases and the most current trend; we should also not adopt best practices that work for Netflix. What is necessary for an organization serving 125 million users may be an impediment to an organization trying to capture its first million. Always focus on first principles and design systems that make sense in the context of the product, the organization, and the consumer.

Discover how to automatically manage containers and microservices with better control and performance using Instana APM. Try it for yourself today.

Topics:
microservices ,velocity ,monolith ,qa

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}