Xuanwo opened a new pull request, #8647:
URL: https://github.com/apache/opendal/pull/8647

   # Which issue does this PR close?
   
   Closes #8246. #8298 removed the staging copy and recorded live S3 
validation. This follow-up fixes a remaining small-write regression and adds 
local allocation measurements.
   
   # Rationale for this change
   
   The core now treats a zero chunk size as unset (#8645). `AsyncOperator.open` 
checks for an unset chunk before handing options to the core, so `chunk=0` 
bypasses the async file's default buffer when the service has no minimum chunk 
size. On a local nginx WebDAV server, that made two one-byte writes fail on the 
second write because the service accepts a single write per object. The old 
adapter accepted both writes and committed them in one request.
   
   # What changes are included in this PR?
   
   Apply the existing 256 KiB coalescing default to `AsyncFile` when the chunk 
size is omitted or zero and the service has no minimum. The regression test 
verifies that 1,000 small writes produce a single PUT with all the bytes. The 
same two-write reproduction succeeds against nginx WebDAV after the fix.
   
   ## Performance verification
   
   Compared CPython 3.12 release builds on the same source base 
(`fe63a79b27083d3d010227c9c21ba5c0d16d0fed`) and dependency lockfile, with the 
old `FuturesAsyncWriter` path restored only in the baseline and the candidate 
built from `25392a31ecf57309d3a4df7347c19a5bde691730`. Each upload read a 
59,158,238-byte local fixture in 8 MiB blocks and wrote it through `AsyncFile` 
to loopback MinIO with 8 MiB parts and CRC32C. Timing included file reads, 
writes and close. Every upload completed with eight parts and passed an 
independent full SHA-256 readback via boto3. Values are medians of eight 
alternating before/after pairs per concurrency.
   
   | Part concurrency | Throughput before → after | Client CPU before → after |
   | --- | ---: | ---: |
   | 1 | 454 → 502 MiB/s | 52.49 → 40.50 ms |
   | 4 | 906 → 1,158 MiB/s | 64.04 → 49.66 ms |
   
   In one separately profiled C4 upload per build, Memray recorded 227 → 0 
native allocation requests of exactly 256 KiB. This allocation class matches 
the old adapter's buffer size. MinIO request timing in those samples reached 
four simultaneous part uploads in each build. The full-object SHA-256 also 
matched in both profiled uploads.
   
   Reference counts on an 8 MiB immutable input stayed at baseline with the old 
path. With the owned buffers, they rose by one after `write` and returned to 
baseline when the closed memory object was deleted. The memory service retains 
the bytes as its stored object.
   
   Cloud S3 timing for this commit remains unmeasured. #8298 includes prior 
live S3 results for the owned-buffer implementation.
   
   # Are there any user-facing changes?
   
   `AsyncOperator.open(..., "wb", chunk=0)` now coalesces small writes as it 
does when `chunk` is omitted. `AsyncFile.write` continues to accept `bytes` and 
return the accepted byte count.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - **Harness:** Pi
   - **Model:** `codex/gpt-6.2-sol`
   - **Effort:** `xhigh`
   - **Role:** Reproduced and fixed the coalescing regression, extended the 
regression test, and ran the local allocation and upload comparison. The 
comparison uses a local S3-compatible service and a baseline that restores the 
old adapter on the same source base.


-- 
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