Skip to content

Conversation

@jsedding
Copy link
Contributor

No description provided.

@jsedding jsedding force-pushed the jsedding/OAK-12040-reduce-http-requests-for-writes branch 3 times, most recently from ed52177 to 28e7f17 Compare December 17, 2025 13:17
@jsedding jsedding force-pushed the jsedding/OAK-12040-reduce-http-requests-for-writes branch from 28e7f17 to a288d5c Compare December 17, 2025 13:18
try {
blob.upload(BinaryData.fromBytes(Arrays.copyOfRange(data, offset, offset + size)), true);
blob.setMetadata(AzureBlobMetadata.toSegmentMetadata(indexEntry));
BinaryData binaryData = BinaryData.fromStream(new ByteArrayInputStream(data, offset, size), (long) size);
Copy link
Contributor

Choose a reason for hiding this comment

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

there's quite a bit of complexity behind this, can you just add a comment, e.g.:

Suggested change
BinaryData binaryData = BinaryData.fromStream(new ByteArrayInputStream(data, offset, size), (long) size);
// upload the binary and set the metadata in a single call to the blobstore
BinaryData binaryData = BinaryData.fromStream(new ByteArrayInputStream(data, offset, size), (long) size);

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice finding. Can you outline the measured improvement from that in the ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can you just add a comment
makes sense, done

Copy link
Contributor Author

@jsedding jsedding Dec 18, 2025

Choose a reason for hiding this comment

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

Nice finding. Can you outline the measured improvement from that in the ticket?

Will do once I get around to measuring something 🙂 However, reducing from 2 to 1 HTTP call cannot make things worse.

From analysis of a log file, I saw that the upload calls had a median of 10ms (and slightly higher avg), while the metadata calls had a median of 8ms (also slightly higher avg). Based on this, I expect a speedup of writes in the range of 30-40%. How that manifests on the JCR level remains to be seen.

Clearly, write-heavy use-cases should benefit most. E.g. I expect compaction to run faster.

Copy link
Contributor Author

@jsedding jsedding Dec 18, 2025

Choose a reason for hiding this comment

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

@joerghoh I added some performance numbers in the ticket. For a write-heavy use-case I measured an improvement of ~45%.

@sonarqubecloud
Copy link

@jsedding jsedding merged commit 251fde2 into trunk Dec 18, 2025
5 of 6 checks passed
@jsedding jsedding deleted the jsedding/OAK-12040-reduce-http-requests-for-writes branch December 18, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants