Large-value GET: copies after lookup vs registered-memory DMA (multi-MiB) #4535
Replies: 2 comments 2 replies
|
Hi,
Streaming & Dynamic Length: RESP is stream-oriented, meaning there is no fixed message boundary. The length of a command or response is not known upfront until the entire payload is parsed. Self-Descriptive Format: It uses prefixes to indicate data types and lengths, e.g., *1\r\n$4\r\nPING\r\n. This requires the server to parse the request and construct a dynamic response, often with variable lengths (especially for GET commands where the value size is unpredictable). Fragmentation: A single logical command can be split across multiple network packets (e.g., *1\r\n, $4\r\n, PING\r\n are all valid fragments). This works well with TCP streams but poses challenges for protocols that expect deterministic, contiguous data blocks. These inherent properties make RESP a "software-friendly" protocol that relies heavily on CPU parsing and dynamic memory management.
Control/Data Plane Separation: To handle the dynamic nature of RESP, the Valkey-over-RDMA implementation typically splits the path: Control Messages (short, e.g., GET command and metadata) are exchanged via RDMA Send/Recv. Data Payload (large values) is transferred via RDMA Read/Write operations. Memory Registration Overhead: Large values must be placed in contiguous, pre-registered memory regions before they can be exposed for RDMA access. This registration and management adds CPU and software overhead. Multi-RTT Interaction: Due to the unpredictable response size, the server cannot initiate a direct RDMA Read for the value without first locating and constructing it. The process requires at least a round-trip of control messages (request → metadata reply → data transfer), incurring additional latency and CPU cycles for protocol orchestration. Software-Orchestrated Data Movement: This data "orchestration" step is performed by the CPU, not the hardware.
RESP is dynamic and streaming, requiring CPU-intensive parsing and construction that cannot be offloaded to a simple DMA engine. RDMA requires certainty and pre-defined parameters (address, length, and timing), which conflict with the on-the-fly nature of RESP responses. Therefore, Valkey Over RDMA must insert a software translation layer that orchestrates the data transfer. The performance ceiling is set by the CPU's ability to parse protocols, manage memory, and coordinate the DMA engine, not by the raw bandwidth of the interconnect. In essence, the GET path cannot be reduced to a single DMA operation because the software must first "understand" the request and "construct" the response before the hardware can be told where to find the data. The ~29.5 Gb/s result reflects the true end-to-end cost of this software-hardware co-design. Please translate this page into EN by AI to understand more. |
|
Thanks @pizhenwei. This is helpful, and it makes sense that a GET is not a single
|
Uh oh!
There was an error while loading. Please reload this page.
We are evaluating Valkey as an external KV-cache tier for LLM inference, where values are often multi-MiB, and we are trying to better understand the architectural ceiling of the large-value GET path.
On the same test environment, we measured:
ib_read_bw, q=16)Any pointers to the relevant Valkey code paths—or corrections to our understanding of the large-value GET path—would be very helpful.
cc @zuiderkwast @PingXie @madolson @enjoy-binbin @pizhenwei
All reactions