jsedding commented on code in PR #2665:
URL: https://github.com/apache/jackrabbit-oak/pull/2665#discussion_r2629479174


##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentArchiveWriter.java:
##########
@@ -77,8 +79,10 @@ protected void doWriteArchiveEntry(RemoteSegmentArchiveEntry 
indexEntry, byte[]
         ioMonitor.beforeSegmentWrite(new File(blob.getBlobName()), msb, lsb, 
size);
         Stopwatch stopwatch = Stopwatch.createStarted();
         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);

Review Comment:
   > 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.



##########
oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureSegmentArchiveWriter.java:
##########
@@ -77,8 +79,10 @@ protected void doWriteArchiveEntry(RemoteSegmentArchiveEntry 
indexEntry, byte[]
         ioMonitor.beforeSegmentWrite(new File(blob.getBlobName()), msb, lsb, 
size);
         Stopwatch stopwatch = Stopwatch.createStarted();
         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);

Review Comment:
   > 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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to