You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: SERVER_ARCHITECTURE.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ All paths below are under `cpp/src/grpc/server/`.
85
85
| `grpc_service_impl.cpp` | `CuOptRemoteServiceImpl`: all 14 RPC handlers (SubmitJob, CheckStatus, GetResult, chunked upload/download, StreamLogs, GetIncumbents, CancelJob, DeleteResult, WaitForCompletion, Status probe). Uses mappers and job_management to enqueue jobs and trigger pipe I/O. |
86
86
| `grpc_server_types.hpp` | Shared structs (e.g. `JobQueueEntry`, `ResultQueueEntry`, `ServerConfig`, `JobInfo`), enums, globals (atomics, mutexes, condition variables), and forward declarations used across server .cpp files. |
87
87
| `grpc_field_element_size.hpp` | Maps `cuopt::remote::ArrayFieldId` to element byte size; used by pipe deserialization and chunked logic. |
88
-
| `grpc_pipe_serialization.hpp` | Serialize/deserialize result blobs (ChunkedResultHeader + array chunks) and chunked request blobs (ChunkedProblemHeader + chunks) and SubmitJobRequest for pipe transfer. |
88
+
| `grpc_pipe_serialization.hpp` | Streaming pipe I/O: write/read individual length-prefixed protobuf messages (ChunkedProblemHeader, ChunkedResultHeader, ArrayChunk) directly to/from pipe fds. Avoids large intermediate buffers. Also serializes SubmitJobRequest for unary pipe transfer. |
89
89
| `grpc_incumbent_proto.hpp` | Build `Incumbent` proto from (job_id, objective, assignment) and parse it back; used by worker when pushing incumbents and by main when reading from the incumbent pipe. |
90
90
| `grpc_worker.cpp` | `worker_process(worker_index)`: loop over job queue, receive job data via pipe (unary or chunked), call solver, send result (and optionally incumbents) back. Contains `IncumbentPipeCallback` and `store_simple_result`. |
@@ -97,9 +97,11 @@ All paths below are under `cpp/src/grpc/server/`.
97
97
For large problems uploaded via chunked gRPC RPCs:
98
98
99
99
1. Server holds chunked upload state in memory (`ChunkedUploadState`: header + array chunks per `upload_id`).
100
-
2. When `FinishChunkedUpload` is called, the server serializes header and chunks (varint-delimited) and sends them to a worker via the job's pipe.
101
-
3. Worker deserializes, runs the solver, and writes result (and optionally incumbents) back via pipes.
102
-
4. Main process result-retrieval thread reads the result pipe and stores the result for `GetResult` or chunked download.
100
+
2. When `FinishChunkedUpload` is called, the header and chunks are stored in `pending_chunked_data`. The data dispatch thread streams them directly to the worker pipe as individual length-prefixed protobuf messages — no intermediate blob is created.
101
+
3. Worker reads the streamed messages from the pipe, reassembles arrays, runs the solver, and writes the result (and optionally incumbents) back via pipes using the same streaming format.
102
+
4. Main process result-retrieval thread reads the streamed result messages from the pipe and stores the result for `GetResult` or chunked download.
103
+
104
+
This streaming approach avoids creating a single large buffer, eliminating the 2 GiB protobuf serialization limit for pipe transfers and reducing peak memory usage. Each individual protobuf message (max 64 MiB) is serialized with standard `SerializeToArray`/`ParseFromArray`.
103
105
104
106
No disk spooling: chunked data is kept in memory in the main process until forwarded to the worker.
0 commit comments