Microservices Interview Questions and Answers: Concepts, Communication, Spring Cloud vs Dubbo, Service Discovery, Fault Tolerance, and Pros & Cons
This article provides a comprehensive overview of microservices, covering their definition, independent communication methods, differences between Spring Cloud and Dubbo, the relationship between Spring Boot and Spring Cloud, fault‑tolerance mechanisms like circuit breaking and degradation, advantages and disadvantages, and a comparison of Eureka and Zookeeper for service registration and discovery.
Table of Contents
What is a microservice?
How do microservices communicate independently?
Differences between Spring Cloud and Dubbo
Relationship between Spring Boot and Spring Cloud
What are circuit breaking and service degradation?
Advantages and disadvantages of microservices, plus real‑world pitfalls
Differences between Eureka and Zookeeper
Typical microservice technology stacks
What is microservice architecture?
1. What is a microservice?
A microservice is a lightweight, single‑purpose service that focuses on a specific function, such as user login, and can run independently. Microservice architecture divides a large system into distributed, business‑oriented modules to address complex business needs.
Martin Fowler notes that there is no single standard definition, but generally a microservice architecture splits an application into small services, each running in its own process, communicating via lightweight protocols, and independently deployable.
In simple terms, a microservice is an independent, single‑responsibility application module developed with Maven in IntelliJ IDEA, typically using Spring Boot to handle a specific business logic.
Microservices emphasize small, focused services that solve a particular problem, similar to a module in an IDE.
Analogy: just as a hospital has separate departments for dentistry and neurology, each department represents a microservice serving a distinct function.
Reference: https://martinfowler.com/bliki/
Chinese translation of the above can be found at: https://blog.csdn.net/u013970991/article/details/53333921
Reference: [120th Issue] Interviewer: Explain what microservices are?
2. How do microservices communicate independently?
Synchronous communication: Dubbo uses RPC, Spring Cloud uses RESTful JSON APIs.
Asynchronous communication: Message queues such as RabbitMQ, ActiveMQ, Kafka, etc.
3. Differences between Spring Cloud and Dubbo
Both are distributed management frameworks.
Dubbo uses binary transmission, consuming less bandwidth; Spring Cloud uses HTTP, which consumes more bandwidth and typically transports JSON.
Dubbo has higher development complexity and many dependency issues for large projects; Spring Cloud offers one‑click generation and native integration.
Spring Cloud’s API contracts are looser, requiring strong governance to prevent uncontrolled version upgrades.
The biggest difference: Spring Cloud abandons Dubbo’s RPC communication and adopts HTTP‑based REST.
Each approach has trade‑offs: RPC offers performance, while REST provides flexibility and decouples client and server contracts, which suits rapidly evolving microservice environments.
4. Relationship between Spring Boot and Spring Cloud
Spring Boot focuses on quickly developing individual microservices (micro‑level); Spring Cloud provides a global coordination and governance framework that manages and integrates those Spring Boot services (macro‑level).
Spring Boot can operate independently of Spring Cloud, but Spring Cloud depends on Spring Boot.
Reference: https://blog.csdn.net/qq_41497111/article/details/91042405
5. What are circuit breaking and service degradation?
Circuit breaking acts like a fuse: when a service becomes unavailable or times out, calls to it are temporarily stopped to prevent system‑wide failure.
Service degradation reduces functionality under high load by returning predefined fallback responses for non‑critical interfaces, preserving overall system stability.
Reference: [121st Issue] Interviewer: What are circuit breaking and service degradation?
6. Advantages and disadvantages of microservices, plus real‑world pitfalls
Advantages: loose coupling, single‑business focus, language‑agnostic, smaller team size, easier to isolate failures, independent deployment, technology flexibility.
Disadvantages: increased management and deployment complexity, more servers, higher communication overhead, operational burden, data consistency challenges, performance monitoring difficulties.
7. Differences between Eureka and Zookeeper for service registration and discovery
Zookeeper follows the CP principle, emphasizing strong consistency and partition tolerance.
Eureka follows the AP principle, emphasizing availability and partition tolerance.
When a Zookeeper leader fails, a new leader election can take a long time, causing temporary service unavailability.
Eureka nodes are equal; if one node fails, others continue to provide service without interruption.
8. Typical microservice technology stacks (examples)
9. What is microservice architecture?
Microservice architecture is the management and integration layer built on top of individual microservices.
It relies on microservices and orchestrates them, similar to a hospital where each department (microservice) is managed by a central administration (architecture).
Source: blog.csdn.net/qq_41497111/article/details/92067565
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.
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
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.
