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

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

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

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

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

Related

  • Micro Frontends Architecture
  • The Pros and Cons of API-Led Connectivity
  • Microservices Testing: Key Strategies and Tools
  • Common Performance Management Mistakes

Trending

  • Event-Driven Microservices: How Kafka and RabbitMQ Power Scalable Systems
  • Apple and Anthropic Partner on AI-Powered Vibe-Coding Tool – Public Release TBD
  • Code Reviews: Building an AI-Powered GitHub Integration
  • Efficient API Communication With Spring WebClient
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. Microservices: Five Architectural Constraints

Microservices: Five Architectural Constraints

By 
Jim Bugwadia user avatar
Jim Bugwadia
DZone Core CORE ·
Feb. 05, 15 · Opinion
Likes (7)
Comment
Save
Tweet
Share
12.9K Views

Join the DZone community and get the full member experience.

Join For Free

Microservices is a new software architecture and delivery paradigm, where applications are composed of several small runtime services.

The current mainstream approach for software delivery is to build, integrate, and test entire applications as a monolith. This approach requires any software change, however small, to require a full test cycle of the entire application.

With Microservices a software module is delivered as an independent runtime service with a well defined API. The Microservices approach allow faster delivery of smaller incremental changes to an application.

There are several tradeoffs to consider with the Microservices architecture. On one hand, the Microservices approach builds on several best practices and patterns for software design, architecture, and DevOps style organization. On the other hand, Microservices requires expertise in distributed programming and can become an operational nightmare without proper tooling in place. There are several good posts that highlight the pros-and-cons of Microservices, and I have added in the references section.

In the remainder of this post, I will define five architectural constraints (principles that drive desired properties) for the Microservices architectural style. To be a Microservice, a service must be:

  1. Elastic
  2. Resilient
  3. Composable
  4. Minimal, and;
  5. Complete

Microservice Constraint #1 - Elastic

A microservice must be able to scale, up or down, independently of other services in the same application.

This constraint implies that based on load, or other factors, you can fine tune your applications performance, availability, and resource usage.

This constraint can be realized in different ways, but a popular pattern is to architect the system so that you can run multiple stateless instances of each microservice, and there is a mechanism for Service naming, registration, and discovery along with routing and load-balancing of requests.

Microservice Constraint #2 - Resilient

A microservice must fail without impacting other services in the same application.

A failure of a single service instance should have minimal impact on the application. A failure of all instances of a microservice, should only impact a single application function and users should be able to continue using the rest of the application without impact.

Adrian Cockroft describes Microservices as loosely coupled service oriented architecture with bounded contexts [3]. To be resilient a service has to be loosely coupled with other services, and a bounded context limits a service’s failure domain.

Microservice  Constraint #3 - Composable

A microservice must offer an interface that is uniform and is designed to support service composition.

Microservice APIs should be designed with a common way of identifying, representing, and manipulating resources, describing the API schema and supported API operations. The ‘Uniform Interfaces constraint of the REST architectural style describes this in detail.

Service Composition is a SOA principle that has fairly obvious benefits, but few guidelines on how it can be achieved. A Microservice interface should be designed to support composition patterns like aggregation, linking, and higher-level functions such as caching, proxies and gateways.

I previously discussed REST constraints and elements in as two part blog post: REST is not about APIs

Microservice  Constraint #4 - Minimal

A microservice must only contain highly cohesive entities

In software, cohesion is a measure of whether things belong together. A module is said to have high cohesion if all objects and functions in it are focused on the same tasks. Higher cohesion leads to more maintainable software.

A Microservice should perform a single business function, which implies that all of its components are highly cohesive. This is also an Single Responsibility Principle (SRP) of object-oriented design [5]

Microservice Constraint #5 - Complete

A microservice must be functionally complete

Bjarne Stroustrup, the creator of C++, stated that a good interface must be, “minimal but complete” i.e. as small as possible, and no smaller.

Similarly, a Microservice must offer a complete function, with minimal dependencies (loose coupling) to other services in the application. This is important, as otherwise its becomes impossible to version and upgrade individual services.

This constraint is designed to oppose the minimal constraint. Put together a microservice must be “minimal but complete.”

Conclusions

Designing a Microservices application requires application of several principles, patterns, and best practices of modular design and service-oriented architectures. In this post, I've outlined five architectural constraints which can help guide and retain the key benefits of a Microservices-style architecture.

For example, Microservices Constraint# 1 - Elastic steers implementations towards separating the data tier from the application tier, and leads to stateless services.

At Nirmata we have built our solution, that makes it easy to deploy and operate microservices applications, using these very same principles. We believe that Microservices style applications, running in containers, will power the next generation of software innovation.

If you are using, or interested in using microservices, I would love to hear from you.

Jim Bugwadia

Founder and CEO
Nirmata

-- For additional content and articles follow us at @NirmataCloud.
-- If you are in the San Francisco Bay Area, come join our Microservices meetup group.

References

[1] Microservices, Martin Fowler and James Lewis,
http://martinfowler.com/articles/microservices.html
[2] Microservices Are Not a free lunch!, Benjamin Wootton, 
http://contino.co.uk/microservices-not-a-free-lunch/
[3] State of the Art in Microservices, Adrian Cockroft, 
http://thenewstack.io/dockercon-europe-adrian-cockcroft-on-the-state-of-microservices/
[4] The Principles of Object-Oriented Design, Robert C. Martin,
http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
microservice application Software architecture SOA

Opinions expressed by DZone contributors are their own.

Related

  • Micro Frontends Architecture
  • The Pros and Cons of API-Led Connectivity
  • Microservices Testing: Key Strategies and Tools
  • Common Performance Management Mistakes

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!