Principle:Apache Dolphinscheduler RPC Server Handler
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Systems, Networking |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A Netty-based server-side RPC handler that receives serialized requests, routes them to registered method invokers via a dispatch map, and returns serialized responses.
Description
The RPC Server Handler principle defines how DolphinScheduler processes incoming RPC requests on the server side. A NettyRemotingServer binds to a port and accepts connections using Netty's ServerBootstrap with configurable boss/worker thread groups. Incoming Transporter messages are decoded and routed by JdkDynamicServerHandler which maintains a Map<String, ServerMethodInvoker> for method dispatch. Each method invoker wraps a concrete service implementation and is registered at startup by scanning Spring beans for @RpcService-annotated interfaces.
This architecture enables efficient multiplexed RPC handling with Netty's event-driven I/O model, supporting thousands of concurrent connections with minimal threading overhead.
Usage
The server handler is automatically configured on master and worker nodes. When implementing a new RPC service, register your implementation bean with Spring and the framework will automatically discover and register its methods with the server handler.
Theoretical Basis
The RPC Server Handler follows the Dispatcher Pattern with Netty's Reactor Pattern:
- Reactor (Netty): Boss threads accept connections, worker threads handle I/O
- Dispatcher: JdkDynamicServerHandler routes requests by method identifier
- Method Invoker: ServerMethodInvoker wraps the actual service method via reflection
// Server-side dispatch flow
onMessageReceived(channel, transporter):
methodId = transporter.header.methodIdentify
invoker = methodInvokerMap.get(methodId)
result = invoker.invoke(deserialize(transporter.body))
channel.writeAndFlush(serialize(result))