What Is Microservices? Architecture, Challenges, and Popular Solutions Explained

This article introduces microservices as a lightweight, autonomous architecture, compares it with monolithic and SOA approaches, outlines the complexities it brings, and reviews the most common open‑source solutions, registration and configuration centers, remote‑call mechanisms, resilience patterns, load‑balancing algorithms, tracing, and monitoring tools.

Su San Talks Tech
Su San Talks Tech
Su San Talks Tech
What Is Microservices? Architecture, Challenges, and Popular Solutions Explained

Overview

Microservices is an architectural style that splits a large application into a set of small, autonomous, loosely‑coupled services, each responsible for a specific business function and communicating via lightweight protocols such as HTTP.

The evolution typically follows: Monolithic → Service‑oriented → Microservices.

What Is a Monolithic Service?

A monolithic service is a traditional tightly‑coupled application where all modules share a single codebase and database, making it hard to maintain and scale as the system grows.

From Monolith to SOA to Microservices

When a monolith becomes too large, it often evolves into a Service‑Oriented Architecture (SOA), which emphasizes independent services with standardized interfaces but does not prescribe service size. Microservices further refine SOA by enforcing small, autonomous services.

Challenges Introduced by Microservices

Increased system complexity – multiple services require handling of communication, deployment, monitoring, and maintenance.

Communication overhead – network calls and serialization add latency.

Data consistency and transaction management – each service has its own datastore, making distributed transactions harder.

Deployment and operations complexity – more independent deployments demand robust pipelines and automation.

Team communication cost – dedicated teams per service increase coordination effort.

Service governance and versioning – registration, discovery, load‑balancing, monitoring, and fault handling become more intricate.

Distributed system challenges – inherent issues like network latency, consistency, and fault tolerance.

Choosing microservices should be based on actual needs; sometimes a monolith suffices.

Popular Microservice Solutions

Dubbo – a high‑performance Java RPC framework offering service registration, discovery, load‑balancing, fault tolerance, and extensible governance (often paired with ZooKeeper or Apollo).

Spring Cloud Netflix – integrates Netflix OSS components (Eureka, Ribbon, Hystrix, Zuul, etc.) but is now in maintenance mode.

Spring Cloud Alibaba – provides a suite of Alibaba‑backed components (Nacos, Sentinel, RocketMQ, etc.) for service registration, configuration, and governance.

Key Differences

Dubbo focuses on RPC with rich governance features, while Spring Cloud Netflix and Alibaba emphasize HTTP‑based RESTful calls and broader ecosystem integration.

Service Registry

A registry stores service metadata to enable service discovery and service registration. Typical registries include:

Eureka – HTTP‑based, simple, self‑protecting.

Consul – supports health checks and key‑value storage.

ZooKeeper – strong consistency, general coordination.

Nacos – supports both AP and CP, provides service discovery and configuration.

Registries also support load balancing, fault recovery, and dynamic configuration.

Configuration Center

Centralized configuration management reduces operational overhead by allowing dynamic updates of database URLs, ports, log levels, etc. Common centers are Spring Cloud Config, ZooKeeper, Consul, Etcd, Apollo, and Nacos.

Nacos stores config in an embedded DB (or MySQL), registers config on startup, provides APIs for retrieval, and supports listeners for change notifications.

Remote Call: HTTP vs RPC

HTTP is an application‑layer protocol focused on request/response semantics, typically using RESTful APIs and text‑based payloads (JSON, XML). RPC abstracts method invocation across processes, supporting binary protocols (e.g., Protobuf) and IDL‑defined interfaces.

In microservices, HTTP‑style calls often use Feign, while RPC calls use Dubbo.

Feign vs Dubbo

Feign – declarative HTTP client, integrates with Ribbon for load balancing, can use Hystrix for fault tolerance.

Dubbo – RPC framework with built‑in service governance, supports multiple serialization protocols.

Both can coexist; Dubbo can use HTTP as transport, and Feign can call RPC endpoints.

Feign Details

@FeignClient(name = "example", url = "https://api.example.com")
public interface ExampleService {
    @GetMapping("/endpoint")
    String getEndpointData();
}

Feign’s first call may be slow due to Ribbon’s lazy loading; pre‑warming the client mitigates this.

Authentication can be passed via a RequestInterceptor that adds an Authorization header.

@Configuration
public class FeignClientConfig {
    @Bean
    public RequestInterceptor requestInterceptor() {
        return template -> template.header("Authorization", "Bearer " + getToken());
    }
    private String getToken() { return "your_token"; }
}

Load‑Balancing Algorithms

Round Robin

Weighted Round Robin

Random

Weighted Random

Least Connection

Hash‑based

Service Resilience

Common patterns include circuit breaking, fallback, request caching, request collapsing, and thread‑pool isolation. Implementations:

Netflix Hystrix (now deprecated, replaced by Resilience4j)

Resilience4j

Alibaba Sentinel

Dubbo’s built‑in mechanisms

Hystrix Example

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
@Service
public class MyService {
    @HystrixCommand(fallbackMethod = "fallbackMethod")
    public String myServiceMethod() { /* business logic */ }
    public String fallbackMethod() { return "default"; }
}

Sentinel Rate Limiting

Sentinel defines resources (e.g., URLs) and applies flow rules using a sliding‑window algorithm. Rules can be loaded programmatically:

List<FlowRule> rules = new ArrayList<>();
FlowRule rule = new FlowRule();
rule.setResource("myResource");
rule.setCount(20);
rule.setGrade(RuleConstant.FLOW_GRADE_QPS);
rules.add(rule);
FlowRuleManager.loadRules(rules);

API Gateway

An API gateway centralizes routing, load balancing, security, caching, monitoring, and protocol conversion. Spring Cloud Gateway (recommended) provides Route, Predicate, and Filter concepts, with a non‑blocking WebFlux foundation.

Distributed Tracing

Tracing helps locate failures across many services. Popular solutions integrated with Spring Cloud include Zipkin, Jaeger, SkyWalking, and Pinpoint.

Distributed Transactions (Seata)

Seata supports AT, TCC, SAGA, and XA transaction modes, coordinating global and branch transactions via a Transaction Coordinator, Transaction Manager, and Resource Manager.

Monitoring & Alerting

Prometheus scrapes metrics from services; Grafana visualizes them. Log aggregation commonly uses the ELK stack (Elasticsearch, Logstash, Kibana), though alternatives like Fluentd, Loki, or cloud‑native solutions exist.

In interviews, Spring Cloud Netflix is often discussed first, followed by Spring Cloud Alibaba; Dubbo is usually treated as an RPC framework.
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendDistributed Systemsservice discovery
Su San Talks Tech
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.