-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Executor currently drains the incoming task queue or stops draining at `.batch_size` before submitting to the API. If tasks are `.submit()`ed at just the right cadence, it's possible to get the Executor to send lots of small batches very frequently rather than coalescing more tasks. The fix implemented here is to allow up to 4 back-to-back API `/submit` calls within a window of 16s _of submissions that do not fully utilize the entire batch_. If more API calls come in after than, then induce a 4s delay so as to play nice with the API. The burst window will hopefully be ample to work within a Jupyter notebook and not be an annoyance to a human working through cells, and only a 4s delay after that until the window clears. Meanwhile, for power users, the burst limit and window are configurable (to a point). Note that this is mostly intended as an education to users -- this is client-side and so completely up to the user to ignore if they so choose. One example: simply create a new Executor -- the state is entirely kept within a single executor so creating a new instance would be a simple workaround. (Discovered via log trawling and conversations with a user in funcx#help.) [sc-35759]
- Loading branch information
1 parent
f8b0c16
commit 1f0f752
Showing
3 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
changelog.d/20240918_223810_kevin_bursty_rate_limit_executor_submit.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Changed | ||
^^^^^^^ | ||
|
||
- The Executor now implements a bursty rate-limit in the background submission | ||
thread. The Executor is designed to coalesce up to ``.batch_size`` of tasks | ||
and submit them in a single API call. But if tasks are supplied to the | ||
Executor at just the right frequency, it will send much smaller batches more | ||
frequently which is "not nice" to the API. This change allows "bursts" of up | ||
to 4 API calls in a 16s window, and then will back off to submit every 4 | ||
seconds. Notes: | ||
|
||
- ``.batch_size`` currently defaults to 128 but is user-settable | ||
|
||
- If the Executor is able to completely fill the batch of tasks sent to the | ||
API, that call is not counted toward the burst limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters