A lightweight, Spring Boot-based RPC (Remote Procedure Call) framework implementation with high performance and extensibility.
This project is a distributed RPC framework built on Spring Boot 2.7.3, providing a comprehensive suite of features including service registration, discovery, load balancing, and network transport. The framework utilizes Protocol Buffers for efficient serialization, enabling high-performance remote service invocations.
- Service Registration and Discovery
- Dynamic Service Routing
- Load Balancing
- Request Interception
- Performance Monitoring
- Spring Framework Integration
- Protocol Buffer Serialization
- Extensible Architecture
The framework adopts a modular design with the following core components:
-
Registry (rpc-registry)
- Service registration and discovery
- Health checking
- Service metadata management
-
Network Transport (rpc-network)
- Network communication layer
- Connection pooling
- Protocol handling
-
Protocol (rpc-protocol)
- Protocol Buffer message definitions
- Protocol encoding/decoding
- Message format specifications
-
Proxy (rpc-proxy)
- Dynamic proxy generation
- Remote service invocation
- Local service exposure
-
Load Balancer (rpc-loadbalancer)
- Multiple load balancing strategies
- Service instance selection
- Traffic distribution
-
Router (rpc-router)
- Request routing
- Service versioning
- Traffic management
-
Interceptor (rpc-interceptor)
- Request/Response interception
- Cross-cutting concerns
- Custom business logic injection
-
Monitor (rpc-monitor)
- Performance metrics collection
- Service health monitoring
- Statistical analysis
-
Spring Integration (rpc-spring)
- Spring Boot autoconfiguration
- Annotation support
- Bean lifecycle management
- rpc-common: Shared utilities and common components
- rpc-handler: Request processing handlers
- rpc-processor: Message processing pipeline
- rpc-example: Example implementations and demos
- rpc-test: Test cases and integration tests
- Java Version: 8+
- Framework: Spring Boot 2.7.3
- Serialization: Protocol Buffers 3.24.0
- Build Tool: Maven 3.0+
- Testing: JUnit 5, Mockito
- JSON Processing: FastJSON, Gson
- JDK 1.8 or higher
- Maven 3.0 or higher
- Git
-
Clone the repository:
git clone [repository-url] cd rpc-framework
-
Build the project:
mvn clean install
-
Start the Registry Server:
./start-test-instances.sh
-
Start Service Providers:
./start-blog-instances.sh
-
Start Service Consumers:
./start-user-instances.sh
Use the corresponding stop scripts:
./stop-test-instances.sh
./stop-blog-instances.sh
./stop-user-instances.sh
Monitor service performance and health:
./get-stats.sh
rpc-framework/
├── rpc-common/ # Common utilities
├── rpc-protocol/ # Protocol definitions
├── rpc-network/ # Network layer
├── rpc-registry/ # Service registry
├── rpc-proxy/ # Service proxy
├── rpc-loadbalancer/ # Load balancing
├── rpc-router/ # Request routing
├── rpc-interceptor/ # Interceptors
├── rpc-monitor/ # Monitoring
├── rpc-spring/ # Spring integration
├── rpc-handler/ # Request handlers
├── rpc-processor/ # Message processors
├── rpc-example/ # Examples
└── rpc-test/ # Tests
- Follow Java coding conventions
- Write comprehensive unit tests
- Document public APIs
- Keep code modular and maintainable
This project is licensed under the MIT License - see the LICENSE file for details.