The Rise of Non-Microservices Architectures
The Rise of Non-Microservices Architectures
Microservices are here to stay, but are they always necessary? Let's take a closer look at their pros and cons in recent projects of note.
Join the DZone community and get the full member experience.Join For Free
This post is a short summary of my recent experiences with customers that are implementing architectures similar to microservices but with different characteristics in the current post-microservices world.
The microservices architectural style has been around for close to five years now, and much has been said and written about it. Today, I see teams deciding not to strictly follow certain principles of the "pure" microservices architecture and to break some of the "rules." Teams are now more informed about the pros and cons of microservices, and they make context-driven decisions respecting team experience and organizational boundaries and accept the fact that not every company is Netflix. Below are some examples I have seen in my recent microservices gigs.
No Premium in Advance
Teams (composed of devs, ops, testers, business analysts, architects, etc.) are becoming more and more aware of the premium they have to pay for the privilege of going to a pure microservices-based architecture. A typical Java-based microservice running on Kubernetes (the most popular microservices platform) will require a Git repository, a Maven module, a collection of tests (unit, integration, acceptance), APIs, Maven artifacts, container images, configurations, secure configurations, build pipelines, design, documentation, etc. At runtime, it will require CPU, memory, disk, networking, metrics aggregation, log aggregation, database, endpoints, service mesh proxy sidecar, etc. It will also need a collection of Kubernetes objects: container, volume, configmap, secret, pod, service, replica set, deployment, etc. Navigating and managing tens or hundreds of these artifacts puts a serious burden on everybody in a team. It's no surprise that recently ThoughtWorks announced it is not intending to put a microservices architecture into the "adopting" phase of its Technology Radar in a foreseeable future.
Considering there is a cost per service (not envisaging the hidden premium), rather than the original "start with tens of lines of code per service", systems start larger, they start as one service — as a mono repository — as long as the service belongs to one team. Then, for every service, there is a clearly identified reason with benefits justifying its existence as an independent microservice. There is a mandatory "existence check" before carving out a standalone service from the monolith. Below are a few very valid reasons for using or not using microservices.
Breaking the Bounded Context
While the most discussed method for decomposition into microservices is decomposition by bounded context, in practice there are many more reasons for creating microservices: decomposing by maturity, decomposing by data-access pattern (read versus write), decomposition by data source (rather than partitioning a data source per microservice, create a microservice per data source), aggregation for a derived functionality (create an orchestrating service for a few other services), aggregation for client convenience (such as the backend for frontend pattern), aggregation to aid system performance, etc.
Shared Data Sources
One of the fundamental principles of microservices is that every service has a separate data store. While in theory, this principle makes perfect sense, in practice, for brownfield projects, it is the hardest part about microservices, and it is not always worth the effort. That is especially true for integration projects where the data source is typically owned by a different team or company and cannot be partitioned to start with. It is still possible to benefit from having independent services sharing the same data store by acknowledging the future constraints caused by the data source level coupling.
Fewer Inflated Expectations
The good news is that teams are now making more-informed decisions rather than blindly trusting conference slides about microservices. In regards to Gartner's hype cycle, after a couple of years of "inflated expectations," the microservices architecture is heading (down) towards the "trough of disillusionment" stage where expectations are more aligned with the real benefits.
From here on, the future is full of enlightenment and productivity-unless another cycle starts (such as serverless) before we reap the benefits of this one.
Microservices favor event-driven interactions and choreography over orchestration to decrease service coupling. But at the same time, we have seen projects like Cadence by Uber and Conductor by Netflix that were created specifically to orchestrate distributed long-running services as an alternative to the choreography approach.
In a different post titled Microservices in a Post-Kubernetes Era, I also described what changes in the microservices architectural style are driven purely by Kubernetes and the cloud-native primitives.
There are also others who have written about non-microservices architectures such as self-contained systems, miniservices, other alternatives that are better than pure microservices in certain contexts.
These alternatives provide good reasons for breaking away from pure microservices principles whenever the context requires it.
The best architecture is the context-driven architecture where you take a well-understood architecture and adapt it your needs. You question every principle and every rule, and you are not afraid of breaking away from some of the prescriptive elements as long as you understand and accept the consequences. A good analogy is "The map is not the territory." If the architecture is the map, the context is the territory.
Let me know which microservices rules you are breaking and if breaking those rules works better for you. Be brave.
Published at DZone with permission of Bilgin Ibryam , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.