Why Microservices Matter: From Monoliths to Decentralized Architecture
This article explains the fundamentals of microservices architecture, contrasting it with monolithic systems, and covers design principles, messaging patterns, integration methods, API‑gateway usage, and data decentralization to help developers build scalable, maintainable backend services.
Monolithic Architecture
Enterprise applications often start by piling many functions into a single monolithic system, such as ERP or CRM. While initial development is fast, the application grows into a "monster" that becomes increasingly difficult to develop, release, locate issues, and scale.
Typical characteristics of monolithic applications include:
Designed, developed, and deployed as a single unit.
Complexity grows over time, making maintenance and new feature addition hard.
Hard to adopt agile development and continuous delivery.
Partial updates require redeploying the whole application.
Horizontal scaling must be done at the application level, causing resource conflicts.
One unstable service can bring down the entire system.
Innovation is difficult because all features share the same framework.
Microservices Architecture
The core idea of microservices is that an application consists of many small, independent services, each running in its own process with no development or deployment dependencies.
Microservices are not merely a split of a monolith; each service can be built with different technology stacks and focuses on a limited business capability.
Design: Scale, Scope, Business Function
When designing microservices, it is crucial to define the service’s scope and responsibilities rather than merely making services as small as possible.
Apply the Single Responsibility Principle to keep each service focused.
Define business boundaries during the design phase.
Service size should be driven by business functionality, not by an arbitrary “small” metric.
Keep service interfaces and protocols simple.
Start with broader service boundaries and refine them over time.
Messaging in Microservices
Microservices favor lightweight communication mechanisms compared to the heavyweight SOAP‑based messages of SOA.
Synchronous Messaging – REST, Thrift
REST is the default synchronous protocol, offering simple HTTP‑based resource APIs. Thrift provides an IDL‑driven, binary‑efficient alternative supporting many languages.
Asynchronous Messaging – AMQP, STOMP, MQTT
Asynchronous messaging decouples producers and consumers, allowing services to communicate without waiting for immediate responses.
Message Formats – JSON, XML, Thrift, ProtoBuf, Avro
Microservices typically use JSON or XML for text‑based messages, and binary formats like ProtoBuf or Avro when efficiency is required.
Service Contracts – Swagger, RAML, Thrift IDL
REST‑based services often describe their APIs with Swagger or RAML, while Thrift services use IDL definitions.
Microservice Integration (Inter‑service Communication)
Unlike SOA’s centralized ESB, microservices aim for lightweight integration.
Point‑to‑Point Calls
Each service exposes a REST API that other services call directly.
While feasible for simple scenarios, point‑to‑point coupling becomes hard to maintain as the system grows.
API‑Gateway Pattern
An API gateway provides a single entry point for clients and handles cross‑cutting concerns such as security, monitoring, and rate limiting.
The gateway abstracts diverse service interfaces into a unified API, routes requests, performs format conversion, and centralizes non‑functional features.
Message‑Broker Approach
Asynchronous communication can be achieved via message queues or topics, decoupling services through producers and consumers (e.g., AMQP, MQTT).
Data Decentralization
In monolithic systems, all modules share a single central database.
Microservices advocate that each service owns its private database, preventing direct access from other services.
Key points of data decentralization:
Each service persists its own business data.
Services cannot directly query other services' databases.
Cross‑service transactions must be handled via service calls, not direct database access.
Decentralized data reduces coupling and allows each service to choose the most suitable storage technology (SQL, NoSQL, etc.).
The next article will cover practical aspects such as service registration, discovery, security, transactions, failure handling, and more.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITFLY8 Architecture Home
ITFLY8 Architecture Home - focused on architecture knowledge sharing and exchange, covering project management and product design. Includes large-scale distributed website architecture (high performance, high availability, caching, message queues...), design patterns, architecture patterns, big data, project management (SCRUM, PMP, Prince2), product design, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
