Architecture
Dubbo Architecture
Specification of Node’s Role
Node | Role Spec |
---|---|
Provider | The provider exposes remote services |
Consumer | The consumer calls the remote services |
Registry | The registry is responsible for service discovery and configuration |
Monitor | The monitor counts the number of service invocations and time-consuming |
Container | The container manages the services’s lifetime |
Service relationship
Container
is responsible for launching, loading, and running the serviceProvider
.Provider
registers its services toRegister
at the time it starts.Consumer
subscribes the services it needs from theRegister
when it starts.Register
returns theProvider
s list toConsumer
, when it changes, theRegister
will push the changed data toConsumer
through long connection.Consumer
selects one of theProvider
s based on soft load balancing algorithm and executes the invocation, if fails, it will choose anotherProvider
.- Both
Consumer
andProvider
will count the number service invocations and time-consuming in memory, and send the statistics toMonitor
every minute.
Dubbo has the following features: Connectivity, Robustness, Scalability and Upgradeability.
Connectivity
Register
is responsible for the registration and search of service addresses, like directory services,Provider
andConsumer
only interact with the registry during startup, and the registry does not forward requests, so it is less stressed- ‘Monitor’ is responsible for counting the number of service invocations and time-consuming, the statistics will assembles in
Provider
’s andConsumer
’s memory first and then sent toMonitor
- ‘Provider’ registers services to ‘Register’ and report time-consuming statistic(not include network overhead) to ‘Monitor’
- ‘Consumer’ gets a list of service provider addresses from
Registry
, call the provider directly according to the LB algorithm, report the time-consuming statistic toMonitor
, which includes network overhead - The connections between
Register
,Provider
andConsumer
are long connections,Moniter
is an exception Register
is aware of the existence ofProvider
through the long connection, whenProvider
gets down,Register
will push the event toConsumer
- It doesn’t affect the already running instances of
Provider
andConsumer
even all of theRegister
andMonitor
get down, sinceConsumer
got a cache ofProvider
s list Register
andMonitor
are optional,Consumer
can connectProvider
directly
Robustness
Monitor
’s downtime doesn’t affect the usage, only lose some sampling data- When the DB server goes down,
Register
can return serviceProvider
s list toConsumer
by checking its cache, but newProvider
cannot register any services Register
is a peer cluster, it will automatically switch to another when any instance goes down- Even all
Register
’s instances go down,Provider
andConsumer
can still conmunicate by checking their local cache - Service
Provider
s are stateless, one instance’s downtime doesn’t affect the usage - After all the
Provider
s of one service go down,Consumer
can not use that service, and infinitely reconnect to wait for serviceProvider
to recover
Scalability
Register
is a peer cluster that can dynamically increases its instances, all clients will automatically discover the new instances.Provider
is stateless, it can dynamically increases the deployment instances, and the registry will push the new service provider information to theConsumer
.
Upgradeablity
When the service cluster is further expanded and the IT governance structure is further upgraded, dynamic deployment is needed, and the current distributed service architecture will not bring resistance. Here is a possible future architecture:
Specification of Node’s Role
Node | Role Spec |
---|---|
Deployer | Local proxy for automatic services deployment |
Repository | The repository is used to store application packages |
Scheduler | The scheduler automatically increases or decreases service providers based on the access pressure |
Admin | Unified management console |
Registry | the registry is responsible for service discovery and configuration |
Monitor | The monitor counts the service call times and time-consuming |
Last modified December 22, 2020: clean up website (6e41905afa)