Repository navigation
Retry on rate limiting - #620
Conversation
can indicate rate limiting.
20d54c0 to
c0f6d8e
Compare
|
Okay, I've also added |
| sync, | ||
| sync_wrapper, | ||
| FSTimeoutError, | ||
| _run_coros_in_chunks, |
There was a problem hiding this comment.
I don't love this private import, so I'm given to just vendor this function over here. What do you think @martindurant?
There was a problem hiding this comment.
We could even expose it as a public function directly from fsspec.
|
Yep, that would be best! Though it would require coordinated releases.
…On Sat, Apr 30, 2022 at 3:50 AM Batuhan Taskaya ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In s3fs/core.py
<#620 (comment)>:
> @@ -12,14 +12,21 @@
from fsspec.spec import AbstractBufferedFile
from fsspec.utils import infer_storage_options, tokenize, setup_logging as setup_logger
-from fsspec.asyn import AsyncFileSystem, sync, sync_wrapper, FSTimeoutError
+from fsspec.asyn import (
+ AsyncFileSystem,
+ sync,
+ sync_wrapper,
+ FSTimeoutError,
+ _run_coros_in_chunks,
We could even expose it as a public function directly from fsspec.
—
Reply to this email directly, view it on GitHub
<#620 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLWQNYUOZAXZXMZFUHR6NDVHUF7JANCNFSM5UXJ2CFA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
S3fs is sister to and closely tied to fsspec - they are always released together. I prefer to keep the function "private" to indicate that ordinary users would not be expected to call it. |
|
Yep, I’m aware they’re both released by you :) If you’re okay with the cross-repo private import, then I am as well |
| for i in range(0, len(files), 1000) | ||
| ] | ||
| ], | ||
| batch_size=3, |
There was a problem hiding this comment.
Where does this batch size come from? I would have thought it could be a much bigger number.
There was a problem hiding this comment.
This comes from two places:
- A rough attempt to stay under 3500 deletes per second. Despite the fact that those docs describe concurrent HTTP requests (rather than object deletes), I found it was pretty easy to hit with this batched approach as well.
- Some experimentation. When I made this as high as ~5-6, I started to see rate limiting with my example in the linked issue.
There was a problem hiding this comment.
With this value, how long did it take to delete ~1000 keys or more?
There was a problem hiding this comment.
This is in the context of many dask tasks doing the same in parallel?
There was a problem hiding this comment.
This is in the context of many dask tasks doing the same in parallel?
No, this is in the context of a bulk delete from a single S3FileSystem instance. That occurs in a dask Client when overwrite=True, but can reproduced by itself as per #484 (comment)
There was a problem hiding this comment.
So if we are submitting just 3 at a time, then to get to 3500, these must come back in about 1ms, right? I didn't think you could go that fast even in the right AWS region. Now we have the tricky problem that the "best" number will depend on where this is called from.
There was a problem hiding this comment.
these must come back in about 1ms, right?
I think they come back in ~1s, but are batched into bulk delete calls of 1000 keys.
Now we have the tricky problem that the "best" number will depend on where this is called from.
Yeah, it's tough to come up with a "best" number. That's what I was attempting to do in #619.
There was a problem hiding this comment.
Of course, so sorry - these are thousands of deletes! Please ignore my hesitation in that case. It totally makes sense to send ~3000 requests and wait for them all to end before sending more.
There was a problem hiding this comment.
I just re-ran my testing scripts with some timing information -- in my case each 1000-key bulk delete took 1-2 seconds, though I don't know how reproducible that is in other contexts.
|
@isidentical , I'm happy with this if you don't have more to say. |
|
Thanks @martindurant! |
This treats
ResponseParserErrorsas retryable, as well asClientErrorsif they containSlowDownin the message. This can mitigate/fix #484, and is a non-mutually-exclusive alternative to #619. Where that PR tries to address rate limiting at the request time, this tries to address it in the responses.In my testing with the snippet here, this helps a lot, but is not a complete fix, as I still often exhaust the default retries. So I might be in favor of both this and #619 (or something similar to it based on
asyn._run_coros_in_chunks)