server: split server.cpp code into server/common/task/queue#17362
Merged
ngxson merged 6 commits intoggml-org:masterfrom Nov 24, 2025
Merged
server: split server.cpp code into server/common/task/queue#17362ngxson merged 6 commits intoggml-org:masterfrom
ngxson merged 6 commits intoggml-org:masterfrom
Conversation
Contributor
Author
|
Ok seems like windows CI are failing due to cloudflare outage: https://www.cloudflarestatus.com/incidents/8gmgl950y3h7 |
Member
|
Yeah, the CIs are completely unreliable today due to the CloudFlare thingy. |
ngxson
commented
Nov 18, 2025
| STOP_TYPE_LIMIT, | ||
| }; | ||
|
|
||
| struct task_params { |
Contributor
Author
There was a problem hiding this comment.
note: slot_params is renamed to task_params as I think it's a more appropriate name
ggerganov
approved these changes
Nov 24, 2025
Comment on lines
+8
to
+11
|
|
||
| #define JSON_ASSERT GGML_ASSERT | ||
| #include <nlohmann/json.hpp> | ||
|
|
Member
There was a problem hiding this comment.
I think it won't be very difficult to include just <nlohmann/json_fwd.hpp> here. For example server-queue.cpp currently indirectly includes nlohmann/json.hpp while it does not need it. We can fix this later.
Nexesenex
added a commit
to Nexesenex/croco.cpp
that referenced
this pull request
Nov 25, 2025
…gml-org#17362) * add server-task, server-common"
Anico2
added a commit
to Anico2/llama.cpp
that referenced
this pull request
Jan 15, 2026
…#17362) * add server-task, server-common * add server-queue * rm redundant includes * move enum stop_type to server-task * server : headers cleanup --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
blime4
referenced
this pull request
in blime4/llama.cpp
Feb 5, 2026
* add server-task, server-common * add server-queue * rm redundant includes * move enum stop_type to server-task * server : headers cleanup --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR splits the
server.cppinto small components:server.cppcontains theserver_context,server_slotand handler functionsserver-commoncontaining most of the functions fromutils.hpp(some one-off functions are moved toserver-task)server-taskcontaining allserver_task_*classes and subclasses. The main idea is to consider these classes as serializer/deserialize. In the future, most of the JSON handling will be done here (instead of scattering across the code base)server-queuecontaining implementation of task queue and result queue. The goal is to group all of the mutex-related logic into one file, potentially reusing them for other things in the future (completely decoupled from other parts of server)flowchart TD server_common -.- main server_task -.- server_slot server_task -.- server_queue server_slot <-->|update slots| server_context server_queue -->|get task| server_context HTTP_handlers -->|post task| server_queue subgraph main server_slot server_context -.- HTTP_handlers end