Skip to content

feat(tool): networkCapacity Tool Refactor + Production Defaults#2834

Open
AlfredoG87 wants to merge 3 commits into
mainfrom
feat/network-capacity-tool-refactor
Open

feat(tool): networkCapacity Tool Refactor + Production Defaults#2834
AlfredoG87 wants to merge 3 commits into
mainfrom
feat/network-capacity-tool-refactor

Conversation

@AlfredoG87
Copy link
Copy Markdown
Contributor

Refactors the networkCapacity tool to produce accurate CN→BN throughput measurements and adds gRPC compression support.

Problem

The old tool had two measurement artifacts:

  1. Server used publishBlockStream() — fully deserializes every BlockItem, which production BN never does.
  2. Client parsed and batched blocks during the gRPC stream, mixing CPU overhead into network timing.

Changes

NetworkCapacityServer.java — replaced publishBlockStream() with open() + Pipelines.bidiStreaming() + PublishStreamRequestUnparsed, matching StreamPublisherPlugin exactly. Only header and proof bytes are parsed; all item bytes stay as raw Bytes.

NetworkCapacityClient.java — two-phase streaming: Phase 1 pre-builds all batches before opening gRPC; Phase 2 streams them with no parse work in the hot path. Waits for all ACKs before half-closing. Supports grpcEncoding: "identity", "gzip", "zstd".

network_capacity_config.proto — added grpcEncoding field to HelidonWebClientConfig.

clientDefaultConfig.json — CN production defaults (Helidon HTTP/2 defaults, priorKnowledge: false, grpcEncoding: "identity").

serverDefaultConfig.json — current BN production defaults (8 MB HTTP/2 window, 128 KB socket buffers). Updated to optimized values in companion PR.

@AlfredoG87 AlfredoG87 added this to the 0.35.0 milestone May 17, 2026
@AlfredoG87 AlfredoG87 self-assigned this May 17, 2026
@AlfredoG87 AlfredoG87 added Improvement Code changes driven by non business requirements Block Node Tools Additional tools related to, but not part of, the Block Node labels May 17, 2026
@AlfredoG87 AlfredoG87 modified the milestones: 0.35.0, 0.34.0 May 17, 2026
@AlfredoG87 AlfredoG87 force-pushed the feat/network-capacity-tool-refactor branch 2 times, most recently from f1dec7b to 82a81e2 Compare May 17, 2026 22:30
- Rewrite NetworkCapacityServer to use open() + PublishStreamRequestUnparsed,
  matching real BN StreamPublisherPlugin pattern (avoids full block deserialization)

- Rewrite NetworkCapacityClient to two-phase streaming: Phase 1 pre-builds all
  request batches before opening gRPC (separates parse/batch overhead from network
  measurement); Phase 2 streams pre-built batches with tight metrics loop

- Add grpcEncoding config field to HelidonWebClientConfig proto (supports
  "identity", "gzip", "zstd"); defaults to "identity"

- Update clientDefaultConfig.json to CN production defaults (65535 initial window,
  16384 max frame, priorKnowledge=false, grpcEncoding="identity")

- Update serverDefaultConfig.json to BN production defaults (8MB window + frame,
  8MB TCP socket buffers, writeQueueLength=8192, tcpNoDelay=true)

Signed-off-by: Alfredo Gutierrez Grajeda <alfredo@hashgraph.com>
Signed-off-by: Alfredo Gutierrez Grajeda <alfredo@hashgraph.com>
Signed-off-by: Alfredo Gutierrez Grajeda <alfredo@hashgraph.com>
@AlfredoG87 AlfredoG87 force-pushed the feat/network-capacity-tool-refactor branch from 82a81e2 to 3ec62ec Compare May 17, 2026 22:38
@AlfredoG87 AlfredoG87 marked this pull request as ready for review May 18, 2026 01:48
@AlfredoG87 AlfredoG87 requested review from a team as code owners May 18, 2026 01:48
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@             Coverage Diff              @@
##               main    #2834      +/-   ##
============================================
+ Coverage     81.52%   81.57%   +0.05%     
- Complexity     1525     1559      +34     
============================================
  Files           142      144       +2     
  Lines          7176     7410     +234     
  Branches        756      777      +21     
============================================
+ Hits           5850     6045     +195     
- Misses         1016     1042      +26     
- Partials        310      323      +13     

see 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Block Node Tools Additional tools related to, but not part of, the Block Node Improvement Code changes driven by non business requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant