chitralverma commented on PR #9377:
URL: https://github.com/apache/opendal/pull/9377#issuecomment-7257596336

   (AI-generated reply) Re [your 
review](https://github.com/apache/opendal/pull/9377#pullrequestreview-6103331120):
 fixed in 9a67fe3814 (head ffa47036b23d052f4336ae811cb17bee85a4736d, which 
merges main at `a6438bff1`; the merge needs no regeneration).
   
   The Python `prefetch` doc, which `ReadKwargs` and `OpenKwargs` share, now 
reads:
   
   > The number of completed chunks that stop counting against `concurrent` 
while they wait to be consumed, in a read with `chunk` and a `concurrent` above 
one.
   >
   > Such a read keeps at most `concurrent` chunks in flight or waiting, 
counting chunks that have completed but have not been consumed. With the 
default, `0`, completed chunks still wait in memory until they are consumed, 
but they keep their slots, so once `concurrent` chunks are in flight or 
waiting, a new request starts only after one is consumed. A positive `prefetch` 
lets up to that many waiting chunks free their slots, so up to `concurrent` 
plus `prefetch` chunks can be in flight or waiting, at the cost of memory.
   >
   > A positive `prefetch` cannot be combined with `content_type`, 
`cache_control`, or `content_disposition` in `read()`. Combining them raises 
`ValueError`.
   
   The `prefetch` parameter of both `read` methods now uses the first sentence, 
and the generator test checks that both docstrings contain it. 
`test_read_options_match_main` pins the new text, and the `ValueError` is 
unchanged.
   
   Evidence on a build of this head, using a 64-byte file on Silo S3 behind a 
logging proxy. The file is opened with `chunk=4` and read 4 bytes at a time, 
with a pause after each read, sync and async. With `concurrent=3, prefetch=0`, 
Silo has received 3, 4, 5, and 6 `GET`s after 1, 2, 3, and 4 chunks are 
consumed. So two completed chunks wait while still counting against 
`concurrent`, and each chunk consumed starts one request. After 4 chunks, 
`prefetch=1`, `2`, and `4` reach 7, 8, and 10 `GET`s. With `concurrent=1`, 
every `prefetch` gives one `GET` per chunk. This matches 
`ConcurrentTasks::has_remaining` (`tasks.len() < concurrent + 
completed.min(prefetch)`), where a task leaves the queue only when its chunk is 
consumed.
   


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