[SYSTEMDS-3946] Enable sending of large (>2GiB) FederatedRequests and…#2496
Conversation
… Responses Federated transfers previously failed for payloads above 2GiB because the single Netty frame size is bounded by a 32-bit length field, capping any request or response at Integer.MAX_VALUE bytes. This patch adds a streaming chunked codec that splits a large payload into bounded frames on the sender and reassembles them on the receiver, so the on-wire size is no longer limited by a single frame. A format detector and format encoder select the chunked path only when the payload exceeds the frame limit, leaving the existing small-message path unchanged to avoid added overhead for the common case. Adds FederatedMaxPayloadTest to exercise the boundary around the former 2GiB cap.
ywcb00
left a comment
There was a problem hiding this comment.
Thank you very much for the PR @Biranavan-Parameswaran :)
I left some minor comments in the code. Could you please have a look at it and resolve it if you find the time. Thanks.
|
|
||
| static final byte MARKER_LEGACY = 0; | ||
| static final byte MARKER_CHUNKED = 1; | ||
| static final long STREAM_THRESHOLD = 1536L << 20; // ~1.5 GB: route below this through the legacy object codec |
There was a problem hiding this comment.
We should use the regular encoder as long as we can, i.e., up to the largest possible message size. Can we increase this default threshold from 1.5GB to (INT_MAX - 1) bytes?
There was a problem hiding this comment.
Good suggestion, but INT_MAX-1 is actually unsafe here. Routing uses a size estimate, not the exact wire size, and the ObjectEncoder overflows its Integer.MAX_VALUE ByteBuf once serialization framing is added. I measured that cliff at about 1.990 GiB, so an estimate just under INT_MAX can still overflow on the wire. I set the threshold to 2000L << 20 (about 1.953 GiB), roughly 40 MB under the cliff, so the regular encoder is used as high as we safely can.
Note the routing also changed since your review. Responses now route by lineage cacheability instead of size, so STREAM_THRESHOLD is now the size guard on the object encoder path rather than the main router.
f5073a4 to
ec0538b
Compare
b5e4165 to
ec0538b
Compare
|
Thanks for the review @ywcb00. All three comments are addressed, and I also ran experiments to back the design choices. Summary of what changed since the reviewed commit. Comments
Follow up work
|
661bf3f to
0e2fc2a
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2496 +/- ##
============================================
+ Coverage 71.47% 71.53% +0.06%
- Complexity 48883 50264 +1381
============================================
Files 1573 1628 +55
Lines 189238 194506 +5268
Branches 37128 37983 +855
============================================
+ Hits 135261 139149 +3888
- Misses 43530 44430 +900
- Partials 10447 10927 +480 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Federated transfers previously failed for payloads above 2GiB because the
single Netty frame size is bounded by a 32-bit length field, capping any
request or response at Integer.MAX_VALUE bytes.
This patch adds a streaming chunked codec that splits a large payload into
bounded frames on the sender and reassembles them on the receiver, so the
on-wire size is no longer limited by a single frame. A format detector and
format encoder select the chunked path only when the payload exceeds the
frame limit, leaving the existing small-message path unchanged to avoid
added overhead for the common case.
Adds FederatedMaxPayloadTest to exercise the boundary around the former
2GiB cap.