Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove chunking from rpc #6345

Merged
merged 6 commits into from
May 22, 2024

Conversation

hansieodendaal
Copy link
Contributor

@hansieodendaal hansieodendaal commented May 17, 2024

Description

Removed chunking from RPC as this does not improve latency or throughput and adds code complexity.

Motivation and Context

See above.

How Has This Been Tested?

System-level tests were conducted syncing a fresh archival base node in a controlled environment over Gigabit wired LAN where only one other base node was connected. The blockchain had many full blocks and many UTXOs, as a result of a 24-hour stress test.

Header sync
No difference could be seen with header sync, as expected, due to the small message sizes.

image

Block sync
Blocks throughput increased during full block sync for both coins-split and normal transactions due to reduced latencies (data transfer time); up to 8% increased block throughput was measured when blocks were filled with normal transactions.

image

What process can a PR reviewer use to test or verify this change?

Review code changes and test data, or perform a similar comparative test.

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

@hansieodendaal hansieodendaal requested a review from sdbondi May 17, 2024 05:33
@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels May 17, 2024
Copy link

github-actions bot commented May 17, 2024

Test Results (CI)

    3 files    120 suites   35m 58s ⏱️
1 275 tests 1 275 ✅ 0 💤 0 ❌
3 817 runs  3 817 ✅ 0 💤 0 ❌

Results for commit cc3258d.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented May 17, 2024

Test Results (Integration tests)

 2 files  + 2  11 suites  +11   46m 9s ⏱️ + 46m 9s
33 tests +33  30 ✅ +30  0 💤 ±0  3 ❌ +3 
38 runs  +38  32 ✅ +32  0 💤 ±0  6 ❌ +6 

For more details on these failures, see this check.

Results for commit cc3258d. ± Comparison against base commit 1d6e0d8.

♻️ This comment has been updated with latest results.

Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I'm not sure if you intended to remove chunking from the client or not. It would be a breaking change to do so but that should be fine at this point.

Comment on lines 756 to 761
proto::rpc::RpcResponse {
request_id,
status: message.status.as_u32(),
flags: message.flags.bits().into(),
payload: message.payload.to_vec(),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice the message.to_proto() function before. That would be better to use than this

Suggested change
proto::rpc::RpcResponse {
request_id,
status: message.status.as_u32(),
flags: message.flags.bits().into(),
payload: message.payload.to_vec(),
}
message.to_proto()

@@ -33,30 +33,12 @@ mod test;
pub const RPC_MAX_FRAME_SIZE: usize = 3 * 1024 * 1024; // 3 MiB
/// Maximum number of chunks into which a message can be broken up.
const RPC_CHUNKING_MAX_CHUNKS: usize = 16; // 16 x 256 Kib = 4 MiB max combined message size
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

SWvheerden
SWvheerden previously approved these changes May 17, 2024
@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label May 17, 2024
@hansieodendaal
Copy link
Contributor Author

Not sure what to do with the failing response_too_big unit test. I get ServerClosedRequest instead of RpcError::RequestFailed at the first check.

@sdbondi
Copy link
Member

sdbondi commented May 21, 2024

Not sure what to do with the failing response_too_big unit test. I get ServerClosedRequest instead of RpcError::RequestFailed at the first check.

The problem was that the "payload too large" message wasn't being constructed properly and, without chunking, the max frame size should be >= max response size.

I pushed fixes for these

@ghpbot-tari-project ghpbot-tari-project added the P-reviews_required Process - Requires a review from a lead maintainer to be merged label May 21, 2024
sdbondi
sdbondi previously approved these changes May 21, 2024
@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label May 21, 2024
Removed chunking from rpc as this does not improve latency or throughput.
@ghpbot-tari-project ghpbot-tari-project added the P-reviews_required Process - Requires a review from a lead maintainer to be merged label May 22, 2024
@hansieodendaal
Copy link
Contributor Author

The problem was that the "payload too large" message wasn't being constructed properly and, without chunking, the max frame size should be >= max response size.

I pushed fixes for these

Oops, did not see that. Working on it now.

@sdbondi
Copy link
Member

sdbondi commented May 22, 2024

The problem was that the "payload too large" message wasn't being constructed properly and, without chunking, the max frame size should be >= max response size.
I pushed fixes for these

Oops, did not see that. Working on it now.

No problem :) readded the fix

@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label May 22, 2024
@SWvheerden SWvheerden merged commit 82f0d6a into tari-project:development May 22, 2024
14 of 16 checks passed
github-merge-queue bot pushed a commit to tari-project/tari-dan that referenced this pull request Jun 14, 2024
Description
---
- remove chunking from RPC protocol

Motivation and Context
---
Chunking does not add any benefit especially when not using tor.
Porting over changes from L1:
tari-project/tari#6345

How Has This Been Tested?
---
Manually

What process can a PR reviewer use to test or verify this change?
---
Should work as before

Breaking Changes
---

- [ ] None
- [ ] Requires data directory to be deleted
- [x] Other - Please specify

BREAKING CHANGE: Any responses which previously triggered chunking (>=
256kb) would not be readable by clients using this PR
@hansieodendaal hansieodendaal deleted the ho_remove_chunks branch June 19, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-acks_required Process - Requires more ACKs or utACKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants