What Is a Microservice? Definitions, Communication, and Key Comparisons
This article explains the concept of microservices, how they communicate via synchronous RPC or asynchronous messaging, compares Spring Cloud with Dubbo, clarifies the relationship between SpringBoot and SpringCloud, and discusses circuit breaking, service degradation, pros and cons, Eureka vs Zookeeper, and a typical technology stack.
Practicing without fundamentals leads to emptiness.
1. What is a microservice?
A single lightweight service is typically an independent microservice . Microservices focus on a single function, such as a login system that only handles authentication, emphasizing single responsibility, out‑of‑the‑box usability, and independent operation . A microservice architecture is a distributed system that partitions services by business domains to address the shortcomings of monolithic systems and meet increasingly complex business needs. Martin Fowler notes that there is no single standard definition, but generally a microservice architecture is a style that splits an application into a set of small services, each running in its own process, communicating via lightweight protocols, built around specific business capabilities, and independently deployable.
In plain terms, a microservice is an independent, single‑purpose application module—often a Maven module in IntelliJ IDEA built with SpringBoot—that handles a specific business logic.
It emphasizes service size, focusing on solving one problem, similar to a hospital department: the dental department handles teeth issues, the neurology department handles head pain—each department is a microservice.
2. How do microservices communicate independently?
Synchronous communication: Dubbo uses RPC remote procedure calls; Spring Cloud uses RESTful JSON APIs. Asynchronous communication: message queues such as RabbitMQ, ActiveMQ, Kafka.
3. Differences between Spring Cloud and Dubbo
Both are distributed management frameworks. Dubbo uses binary transmission, consuming less bandwidth; Spring Cloud uses HTTP with JSON payloads, consuming more bandwidth. Dubbo has higher development complexity and many dependent JARs, making large projects difficult; Spring Cloud offers one‑click generation and native integration for third‑party libraries. Spring Cloud’s loosely defined interface contracts require strong governance to prevent uncontrolled upgrades. Key difference: Spring Cloud abandons Dubbo’s RPC communication and adopts HTTP‑based REST. Strictly speaking, each approach has pros and cons; REST sacrifices some performance but avoids the tight code‑level coupling of native RPC, making it more suitable for rapidly evolving microservice environments.
4. Relationship between SpringBoot and SpringCloud
SpringBoot focuses on rapid development of individual microservices (micro level); SpringCloud provides a global coordination and governance framework that manages multiple SpringBoot services (macro level). SpringBoot can be used independently, but SpringCloud depends on SpringBoot.
5. What are circuit breaking and service degradation?
Circuit breaking acts like a fuse: when a service becomes unavailable or times out, it temporarily stops calls to prevent system‑wide cascade failures. Service degradation reduces functionality under high load by returning predefined fallback responses for non‑critical interfaces, preserving overall system stability.
6. Advantages and disadvantages of microservices (and common pitfalls)
Advantages: loose coupling, single‑business focus, language‑agnostic, smaller team size, easier fault isolation, independent technology choices, and clear separation from UI concerns. Disadvantages: increased management and deployment complexity, more servers, higher communication overhead, greater operational burden, data consistency challenges, and the need for comprehensive monitoring.
7. Differences between Eureka and Zookeeper for service registration and discovery
Zookeeper follows the CP principle, offering strong consistency and partition tolerance; Eureka follows the AP principle, emphasizing availability and partition tolerance. Zookeeper’s leader election can cause temporary unavailability during failover, whereas Eureka’s nodes are equal and continue serving if one fails.
8. Typical microservice technology stack
Service development: SpringBoot, Spring, SpringMVC
Service configuration & management: Netflix Archaius, Alibaba Diamond
Service registry & discovery: Eureka, Consul, Zookeeper
Service invocation: REST, RPC (Dubbo), gRPC
Circuit breakers: Hystrix, Envoy
Load balancing: Nginx, Ribbon
Client‑side tools: Feign
Message queues: Kafka, RabbitMQ, ActiveMQ
Configuration center: Spring Cloud Config, Chef
API gateway: Zuul
Monitoring: Zabbix, Nagios, Metrics, Spectator
Distributed tracing: Zipkin, Brave, Dapper
Deployment: Docker, OpenStack, Kubernetes
Data stream libraries: Spring Cloud Stream (wraps Redis, RabbitMQ, Kafka)
Event bus: Spring Cloud Bus
9. What is a microservice architecture?
Microservice architecture is the management and integration layer built on top of individual microservices. It relies on the microservices themselves, similar to a hospital where each department is a microservice and the hospital as a whole represents the architecture.
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.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
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.
