Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,46 @@ jobs:
-Drpc.registry=local
-Drpc.protocol=netty

# Performance data is observational only. Hosted Runner variance makes absolute
# latency/QPS unsuitable as a merge threshold, but every run publishes the raw
# samples and summary so regressions can be inspected over time.
- name: Run RPC performance snapshot
run: >-
mvn -B -ntp test
-pl rpc-consumer -am
-Dtest=RpcPerformanceSnapshotTest
-Dsurefire.failIfNoSpecifiedTests=false
-Drpc.registry=local
-Drpc.protocol=netty
-Drpc.serializer=kryo
-Drpc.perf.warmup=100
-Drpc.perf.sequential-requests=200
-Drpc.perf.concurrent-requests=1000
-Drpc.perf.concurrency=16

- name: Publish RPC performance summary
if: always()
shell: bash
run: |
if [[ -f rpc-consumer/target/rpc-performance/summary.md ]]; then
cat rpc-consumer/target/rpc-performance/summary.md >> "$GITHUB_STEP_SUMMARY"
else
{
echo "# RPC CI Performance Snapshot"
echo
echo "No performance snapshot was generated. Check the test logs for the failure cause."
} >> "$GITHUB_STEP_SUMMARY"
fi

- name: Upload RPC performance snapshot
if: always()
uses: actions/upload-artifact@v7
with:
name: rpc-performance-snapshot
retention-days: 30
if-no-files-found: warn
path: rpc-consumer/target/rpc-performance/

- name: Upload integration test reports
if: always()
uses: actions/upload-artifact@v7
Expand Down
41 changes: 18 additions & 23 deletions rpc-common/src/main/proto/rpc_meta.proto
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
syntax = "proto3";

option java_package = "com.xiaoyu.rpc.common.vo"; // 生成 Java 类的包名

// 拆分生成多个 Java 文件,避免全部消息挤在一个类里
option java_package = "com.xiaoyu.rpc.common.vo";
option java_multiple_files = true;

// 请求对象
enum RpcStatusCode {
RPC_STATUS_UNSPECIFIED = 0;
SUCCESS = 1;
SERVICE_NOT_FOUND = 2;
METHOD_NOT_FOUND = 3;
INVALID_ARGUMENT = 4;
SERVER_BUSY = 5;
BUSINESS_ERROR = 6;
INTERNAL_ERROR = 7;
TIMEOUT = 8;
UNAVAILABLE = 9;
CLIENT_CLOSED = 10;
}

message RpcRequest {
// 对应 String interfaceName
string interface_name = 1;

// 对应 String methodName
string method_name = 2;

// 对应 Class<?>[] paramTypes
// Proto存不了Class对象,只能存全类名(String),比如 "java.lang.String"
repeated string param_types = 3;

// 对应 Object[] parameters
// Proto存不了Object,必须存成二进制(bytes)。
// 这里用 repeated 表示数组
repeated bytes parameters = 4;

// 请求ID,用于多路复用
string request_id = 5;
map<string, string> metadata = 6;
}

// 响应对象
message RpcResponse {
// 对应 Object data
// 同样无法存Object,只能存序列化后的二进制
bytes data = 1;

// 对应 String message
string message = 2;

// 请求ID,用于多路复用
string request_id = 3;
RpcStatusCode status_code = 4;
string error_type = 5;
}

service GrpcService {
Expand Down
Loading