Mastering Microservice Architecture: Key Components Every Backend Engineer Needs
This article outlines the essential building blocks of a modern microservice architecture—traffic entry with Nginx, API gateway selection, business service design, service registration, caching and distributed locks, persistent storage strategies, document-oriented stores, messaging middleware, log aggregation, task scheduling, and distributed object storage—providing practical guidance for backend engineers.
Currently, many companies have adopted microservice architecture. Below is a concise overview of common components in microservice design, emphasizing the need for a holistic understanding beyond isolated implementation.
Traffic Entry – Nginx
Nginx serves as the external gateway, handling request routing, load balancing, and static‑dynamic separation. It is typically deployed in multiple nodes with keepalived for high availability.
Gateway
The gateway sits behind Nginx and provides authentication, routing, protocol conversion, and traffic monitoring. Spring Cloud Gateway is a common choice, though alternatives such as Zuul, Kong, and others may be selected based on specific trade‑offs.
Business Components
After the gateway, business services (e.g., account, order, invoice, checkout) are split into independent microservices. Inter‑service calls use Feign with Ribbon for client‑side load balancing. Proper domain modeling often follows DDD principles.
Service Registry
A service registry (e.g., Eureka, Zookeeper, Nacos) is essential for dynamic discovery. While Eureka is still used, Nacos is recommended for both registration and distributed configuration.
Cache and Distributed Lock
Redis is employed as a cache for hot data and as a distributed lock mechanism. High availability is achieved with Sentinel (master‑slave + sentinel nodes) or Redis Cluster for scaling.
Persistent Data Layer
MySQL is the primary relational database, often deployed in master‑slave mode with read‑write separation. When data volume grows, horizontal sharding (both vertical and horizontal) may be introduced.
Structured Data Storage
For non‑relational or search‑heavy scenarios, Elasticsearch or MongoDB are used. Elasticsearch provides powerful DSL queries and supports features like GIS search.
Message Middleware
Asynchronous decoupling between services is achieved with message queues such as RabbitMQ or RocketMQ, ensuring reliable delivery and persistence.
Log Collection
Logs from distributed nodes are aggregated using the ELK stack: Filebeat collects logs, Logstash transforms them, Elasticsearch stores them, and Kibana provides searchable visualizations.
Filebeat → Logstash → Elasticsearch → Kibana
Task Scheduling Center
Scheduled tasks use Spring’s @Scheduled or Quartz for single‑node scenarios. Distributed scheduling solutions include Quartz with a shared database, Elastic‑Job (Zookeeper‑coordinated), and XXL‑JOB, which abstracts scheduling from business logic.
Distributed Object Storage
File uploads are stored in distributed object storage systems such as MinIO, Alibaba OSS, or FastDFS, enabling scalable and reliable media handling.
Architect
Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.
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.