Essential Microservice Architecture Components Explained
This article outlines the key building blocks of a microservice architecture—including Nginx as the traffic entry, Spring Cloud Gateway, service registration, Redis caching, MySQL persistence, Elasticsearch, message queues, ELK logging, distributed scheduling, and object storage—providing practical guidance on design choices and high‑availability setups.
Introduction
Microservice architecture has been widely adopted in many companies. The diagram below gives a concise overview of the common components used in microservice design, emphasizing the need for a holistic understanding rather than just moving code.
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 to ensure high availability.
Gateway
Placed after Nginx, the gateway performs authentication, routing, protocol conversion, and traffic monitoring. Spring Cloud Gateway is used in the example, with alternatives such as Zuul1, Zuul2, and Kong. JWT and OAuth2 provide token‑based authentication.
Business Components
These are the individual microservices (e.g., account, order, invoice, checkout). Services communicate via Feign, which integrates Ribbon for client‑side load balancing. Proper domain boundaries can be guided by DDD.
Service Registry
A registry (e.g., Zookeeper, Eureka, Nacos) is essential for dynamic service discovery. Nacos is recommended as it also functions as a distributed configuration center.
Cache and Distributed Lock
Redis is used for caching hot data and implementing distributed locks. High availability is achieved with Sentinel (one master, two slaves, plus three sentinel nodes) or Redis Cluster for sharding large datasets.
Data Persistence Layer
MySQL is the typical relational database, deployed in a master‑slave configuration with read/write separation. When a single table becomes a bottleneck, horizontal (sharding) and vertical splitting are employed.
Structured Data Storage
For non‑relational data such as JSON, Elasticsearch or MongoDB are preferred. Elasticsearch offers powerful DSL queries and even GIS capabilities.
Message Middleware
Asynchronous decoupling is achieved with message queues like RabbitMQ or RocketMQ, ensuring reliable delivery beyond simple multithreading.
Log Collection
The ELK stack (Filebeat → Logstash → Elasticsearch → Kibana) aggregates logs from distributed nodes, enabling centralized search and visualization.
Task Scheduling Center
Scheduling can be handled by Spring’s @Scheduled, Quartz, or distributed solutions such as Elastic‑Job and XXL‑JOB, which provide high availability and job sharding.
Distributed Object Storage
File uploads are stored in distributed object storage solutions such as MinIO, Alibaba OSS, or FastDFS, avoiding reliance on local server disks.
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.
Su San Talks Tech
Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.
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.
