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

server: allow to override threads server pool with --threads-http #5794

Merged
merged 1 commit into from
Mar 1, 2024

Conversation

phymbert
Copy link
Collaborator

@phymbert phymbert commented Feb 29, 2024

Motivation

The default httplib threads pool is set to std::thread::hardware_concurrency()
which is NOT always adapted for completions.
As far, completions tasks can be deferred, http server threads pool
can quickly be full by reaching the number of available host cpu cores
while actually continuous batching can accept more requests on the GPU device.

This fix allows the user to choose the balanced number of threads in the http server pool.

Changes

Introduce --threads-http N to override the default configuration.

@phymbert phymbert requested review from ggerganov and ngxson February 29, 2024 10:25
@phymbert phymbert force-pushed the feature/server-http-threads branch from ccad425 to a55e8fc Compare February 29, 2024 10:36
@ngxson ngxson self-requested a review February 29, 2024 11:29
@phymbert phymbert changed the title server: allow to override threads server pool with --threads-server server: allow to override threads server pool with --threads-http Feb 29, 2024
@phymbert
Copy link
Collaborator Author

phymbert commented Mar 1, 2024

@ggerganov Hi, as I got one approval, should I wait for yours ? thanks

@ggerganov
Copy link
Member

If a PR touches just the server code, you don't need to wait for my approval.

Btw, isn't it better to reuse the --parallel parameter instead of introducing a new one?

@phymbert
Copy link
Collaborator Author

phymbert commented Mar 1, 2024

If a PR touches just the server code, you don't need to wait for my approval.

Noted thanks.

Btw, isn't it better to reuse the --parallel parameter instead of introducing a new one?

No there are different meaning, --parallel for number of sequences/slots on the llama backend, --threads-http for number of concurrent http requests on httplib (which can generate deferred tasks if all slots are processing).

@phymbert phymbert merged commit 5cb02b4 into master Mar 1, 2024
61 checks passed
@phymbert phymbert deleted the feature/server-http-threads branch March 1, 2024 09:08
hazelnutcloud pushed a commit to hazelnutcloud/llama.cpp that referenced this pull request Mar 10, 2024
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
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.

3 participants