mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-09-26 23:25:33 +00:00
perf(prom): release the compressed remote write body after decompression
Both the v1 and v2 decoders held the compressed Bytes until they returned, which spans the whole protobuf decode and row conversion. Decompression copies the payload into an independent buffer, so the body can go as soon as it succeeds. The compression fallback, decode errors and request counting are unchanged. Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
This commit is contained in:
@@ -77,6 +77,8 @@ pub fn decode_remote_write_request(
|
||||
// fallback to the other compression method
|
||||
try_decompress(!is_zstd, &body[..])?
|
||||
};
|
||||
// Decompression copied the payload out, so the compressed body is no longer needed.
|
||||
drop(body);
|
||||
|
||||
let mut request = PROM_WRITE_REQUEST_POOL.pull(PromWriteRequest::default);
|
||||
|
||||
|
||||
@@ -143,6 +143,8 @@ pub(crate) fn decode_remote_write_v2(
|
||||
} else {
|
||||
try_decompress(!is_zstd, &body[..])?
|
||||
};
|
||||
// Decompression copied the payload out, so the compressed body is no longer needed.
|
||||
drop(body);
|
||||
let request = BorrowedRequest::decode(&buf).context(error::DecodePromRemoteRequestSnafu)?;
|
||||
drop(decode_timer);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user