Skip to content

Performance proposal with ch-go #1

@xzkostyan

Description

@xzkostyan

Hi.

Reading and writing data packets is really expensive in any language. If you really need some connection inspection (I suppose you do) you should decode at least information packets, except data packet.

The problem is that data packet doesn't always has block size: only if it's singed. You can try to read compressed data block without decoding it with ch-go. By default clickhouse-client uses lz4 compression with singing by cityhash. Client sets compression method byte right before the query body. For quick & dirty you can assume it's on.

Layout of compressed by LZ4 data package is quite simple:

So in case of LZ4 compression you should read following amount of bytes to fetch data block without decoding it:

size with header - 1 (compression byte) - 4 (decompressed size).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions