Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change the logic to handle dynamic batching #6066

Merged
merged 11 commits into from
Oct 4, 2023
Merged

Conversation

JoanFM
Copy link
Member

@JoanFM JoanFM commented Oct 3, 2023

This PR fixes the behavior of dynamic batching.

  • It makes sure that no batch larger than preferred batch size gets into the Executor.
  • It allows the requests to be returned to the client as they are processed without waiting for other requests to be ready, this should improve the average latency of the system.

@github-actions github-actions bot added size/M area/core This issue/PR affects the core codebase labels Oct 3, 2023
@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (810d8d4) 76.75% compared to head (91a8a78) 76.87%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6066      +/-   ##
==========================================
+ Coverage   76.75%   76.87%   +0.12%     
==========================================
  Files         145      145              
  Lines       13925    13986      +61     
==========================================
+ Hits        10688    10752      +64     
+ Misses       3237     3234       -3     
Flag Coverage Δ
jina 76.87% <95.83%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
jina/serve/runtimes/worker/batch_queue.py 96.59% <97.61%> (+0.99%) ⬆️
jina/serve/runtimes/worker/request_handling.py 81.36% <83.33%> (+0.17%) ⬆️

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

JoanFM added 2 commits October 3, 2023 16:23
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
@JoanFM JoanFM force-pushed the fix-dynamic-batching branch from 80445a0 to 1004f02 Compare October 3, 2023 15:46
@github-actions github-actions bot added the area/testing This issue/PR affects testing label Oct 3, 2023
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
@JoanFM JoanFM force-pushed the fix-dynamic-batching branch from 6ff2cfe to d351bd7 Compare October 3, 2023 17:29
@JoanFM JoanFM marked this pull request as ready for review October 3, 2023 21:18
@github-actions github-actions bot added the size/L label Oct 4, 2023
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
@JoanFM JoanFM force-pushed the fix-dynamic-batching branch from f0b5820 to f7561ab Compare October 4, 2023 07:47
jina/serve/runtimes/worker/batch_queue.py Outdated Show resolved Hide resolved
jina/serve/runtimes/worker/batch_queue.py Outdated Show resolved Hide resolved
jina/serve/runtimes/worker/batch_queue.py Outdated Show resolved Hide resolved
jina/serve/runtimes/worker/batch_queue.py Outdated Show resolved Hide resolved
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
@JoanFM JoanFM force-pushed the fix-dynamic-batching branch 2 times, most recently from 19d1dcf to a6df665 Compare October 4, 2023 09:04
JohannesMessner
JohannesMessner previously approved these changes Oct 4, 2023
Copy link
Contributor

@JohannesMessner JohannesMessner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one tiny comment

jina/serve/runtimes/worker/batch_queue.py Outdated Show resolved Hide resolved
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
@JoanFM JoanFM force-pushed the fix-dynamic-batching branch from 3bf6e6e to 91a8a78 Compare October 4, 2023 09:31
@JohannesMessner
Copy link
Contributor

btw i think it is fair to call this a feature or at least a performance improvement, the old implementation was correct (we never made any guarantees that the actual batch size would not be bigger than the preferred one), just not optimized for this scenario.

@JoanFM JoanFM changed the title fix: fix the logic to handle dynamic batching feat: change the logic to handle dynamic batching Oct 4, 2023
@JoanFM JoanFM merged commit a12ce6c into master Oct 4, 2023
127 of 129 checks passed
@JoanFM JoanFM deleted the fix-dynamic-batching branch October 4, 2023 10:09
@JoanFM JoanFM mentioned this pull request Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core This issue/PR affects the core codebase area/testing This issue/PR affects testing size/L size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants