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
91 changes: 69 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: CI
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/PERFORMANCE.md'
pull_request:
branches: [ main ]

Expand Down Expand Up @@ -70,6 +72,8 @@ jobs:
name: RPC Integration
runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
performance_markdown: ${{ steps.performance-record.outputs.markdown }}

steps:
- name: Checkout code
Expand All @@ -92,8 +96,8 @@ jobs:
-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.
# latency/QPS unsuitable as a merge threshold. PR CI validates the snapshot;
# successful main CI runs persist the result into docs/PERFORMANCE.md.
- name: Run RPC performance snapshot
run: >-
mvn -B -ntp test
Expand All @@ -108,28 +112,22 @@ jobs:
-Drpc.perf.concurrent-requests=1000
-Drpc.perf.concurrency=16

- name: Publish RPC performance summary
if: always()
- name: Prepare performance record
id: performance-record
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/
summary='rpc-consumer/target/rpc-performance/summary.md'
test -f "$summary"
{
echo 'markdown<<RPC_PERFORMANCE_EOF'
sed \
-e '1{/^# RPC CI Performance Snapshot$/d;}' \
-e '/^> Observational snapshot only\./d' \
-e '/^Raw per-request samples are available/d' \
-e 's/^## Framework metrics$/### Framework metrics/' \
"$summary"
echo 'RPC_PERFORMANCE_EOF'
} >> "$GITHUB_OUTPUT"

- name: Upload integration test reports
if: always()
Expand All @@ -140,6 +138,55 @@ jobs:
if-no-files-found: warn
path: '**/target/surefire-reports/'

record-performance:
name: Record Performance
if: >-
github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
needs.rpc-integration.result == 'success'
needs: [ rpc-integration ]
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write

steps:
- name: Checkout main
uses: actions/checkout@v7
with:
ref: main
fetch-depth: 0

- name: Append performance snapshot
shell: bash
env:
PERFORMANCE_MARKDOWN: ${{ needs.rpc-integration.outputs.performance_markdown }}
run: |
test -n "$PERFORMANCE_MARKDOWN"
mkdir -p docs
test -f docs/PERFORMANCE.md

short_sha="${GITHUB_SHA:0:7}"
recorded_at="$(date -u '+%Y-%m-%d %H:%M:%S UTC')"

{
echo
echo '---'
echo
echo "## CI Snapshot — ${recorded_at} — \`${short_sha}\`"
echo
printf '%s\n' "$PERFORMANCE_MARKDOWN"
} >> docs/PERFORMANCE.md

- name: Commit performance history
shell: bash
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add docs/PERFORMANCE.md
git commit -m 'docs: record RPC performance snapshot [skip ci]'
git push origin HEAD:main

ci-gate:
name: CI Gate
if: always()
Expand Down
37 changes: 37 additions & 0 deletions docs/PERFORMANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# RPC Performance History

该文档由 CI 持续维护,用于记录 Java-RPC 真实端到端调用链路的性能快照。

> 这些数据来自 GitHub Hosted Runner,适合观察趋势和发现明显回归,不作为绝对性能承诺或硬性合并门槛。测试固定使用 Local Registry + Netty + Kryo,并保持固定 warmup、请求量和并发度以提高不同运行之间的可比性。

## 测试配置

- Warmup:100 次 RPC
- 顺序阶段:200 次 RPC,并发度 1
- 并发阶段:1000 次 RPC,并发度 16
- Registry:`local`
- Protocol:`netty`
- Serializer:`kryo`
- 记录指标:吞吐、Avg、P50、P95、P99、Max,以及 Client / Server 内置 metrics

## 历史记录

### PR #11 CI 基线

- Commit: `281d526ebe6ccd0e970453fc9094b85bf08cfe96`
- Java: `17.0.20.1`
- CPU visible to JVM: `4`

| Phase | Requests | Concurrency | Throughput req/s | Avg ms | P50 ms | P95 ms | P99 ms | Max ms |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| sequential | 200 | 1 | 482.033 | 2.066 | 1.535 | 4.578 | 6.195 | 9.340 |
| concurrent | 1000 | 16 | 1537.520 | 10.250 | 9.376 | 17.876 | 22.806 | 27.916 |

#### Framework metrics

| Phase | Side | Total | Success | Failed | Timeout | Active | Metric avg ms | Metric max ms |
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| sequential | CLIENT | 200 | 200 | 0 | 0 | 0 | 1.832 | 7.988 |
| sequential | SERVER | 200 | 200 | 0 | 0 | 0 | 0.240 | 3.970 |
| concurrent | CLIENT | 1000 | 1000 | 0 | 0 | 0 | 9.692 | 25.216 |
| concurrent | SERVER | 1000 | 1000 | 0 | 0 | 0 | 0.661 | 12.092 |