Skip to content

Add multiprocess support #1394

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

Closed
wants to merge 2 commits into from
Closed

Conversation

daveliddell
Copy link
Contributor

Service is refactored to allow for either single process (as it is already), with multiple services in that process, or one process per service.

Default is multi-process! Please provide feedback if you would rather see single process as the default.

  • Factored HTTP out of ClientGenerateBatchProcess, replacing it with a generic response_handler callback
  • Factored Service creation out of lifecycle, replacing it with a service manager class. There are two service managers: one for single process and one for multi-process
  • Added instance_num to service, so that the service can self-identify which instance it is (for diagnostic messages etc.)
  • Shortfin and service setup moved to a new LlmServiceEnvironment class, used by both service managers
  • Multi-process service manager uses a request and response queue to send request objects to a subprocess, managed by LlmServiceProcess, which returns the raw bytes of the response to the main process
  • Multi-process service manager has some refinements to service selection to try to keep batches of 16 together: new requests don't go into a queue until the previous flight has disembarked. Gains ~0.5-0.7 RPS. More work to be done after the merge
  • Single process service selection has some minor tweaks, but the multi-process algorithm isn't there yet because it's more invasive to the service class. Will revisit after merge
  • generate_request HTTP handler refactored to delegate service selection to service manager. Provides the HTTP-aware response handler to ClientGenerateBatchProcess
  • New command line switch to choose single process over multi-process

Signed-off-by: daveliddell <[email protected]>
Signed-off-by: daveliddell <[email protected]>
@zphoenixrises zphoenixrises deleted the branch chai_demo June 4, 2025 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants