Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

switch from gzip to zstd for qlog compression #190

Merged
merged 1 commit into from
Jan 21, 2021
Merged

Conversation

marten-seemann
Copy link
Collaborator

When running a high-bandwidth connection, qlogging consumes about ~40% CPU, of which 1/4 is spent on JSON encoding an 3/4 is spent on running gzip. Switching from gzip to zstd reduces the time spent on compression to 1/2 of the time spent on JSON encoding. That's a speedup of 6x.

Changing the compression level doesn't actually have a large influence on the file size (in my tests I wasn't able to gain more than 10% by increasing it), so using the fastest compression makes sense here. The zst file will be roughly as large as the gzip file.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as long as this builds fine with CGO_ENABLED=0.

@marten-seemann
Copy link
Collaborator Author

Why would it not? klauspost/compress/zstd is a pure Go implementation.

@Stebalien
Copy link
Member

It should be fine. I just want to make sure because other packages in that repo do use CGO, and sometimes the CGO dependency ends up leaking if people aren't careful.

@marten-seemann
Copy link
Collaborator Author

Just confirmed that it actually builds with CGO_ENABLED=0. It does.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants