Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Intel-QAT-based ZSTD_QAT compression codec #57509

Merged
merged 32 commits into from Jan 10, 2024

Conversation

jinjunzh
Copy link
Contributor

@jinjunzh jinjunzh commented Dec 5, 2023

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Intel QuickAssist Technology (QAT) provides hardware-accelerated compression and cryptograpy. ClickHouse got a new compression codec ZSTD_QAT which utilizes QAT for zstd compression. The codec uses Intel's QATlib and Inte's QAT ZSTD Plugin. Right now, only compression can be accelerated in hardware (a software fallback kicks in in case QAT could not be initialized), decompression always runs in software.

@rschu1ze rschu1ze self-assigned this Dec 5, 2023
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Dec 9, 2023
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-feature Pull request with new product feature submodule changed At least one submodule changed in this PR. labels Dec 9, 2023
@robot-clickhouse-ci-2
Copy link
Contributor

robot-clickhouse-ci-2 commented Dec 9, 2023

This is an automated comment for commit ced9e93 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker image for serversThe check to build and optionally push the mentioned image to docker hub✅ success
Docs CheckBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integrational tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
SQLancerFuzzing tests that detect logical bugs with SQLancer tool✅ success
SqllogicRun clickhouse on the sqllogic test set against sqlite and checks that all statements are passed✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Style CheckRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success
Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR⏳ pending
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests❌ failure
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests❌ failure
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors❌ failure

@FrankChen021
Copy link
Contributor

Hi @jinjunzh , are there any benchmark data that you can share with us? I didn't see it from the [QAT ZSTD Plugin] repo.

@jinjunzh
Copy link
Contributor Author

Hi @jinjunzh , are there any benchmark data that you can share with us? I didn't see it from the [QAT ZSTD Plugin] repo.
Please look into this:
https://community.intel.com/t5/Blogs/Tech-Innovation/Artificial-Intelligence-AI/Intel-QuickAssist-Technology-Zstandard-Plugin-an-External/post/1509818

@rschu1ze rschu1ze changed the title Add Intel®-QAT based QATZSTD compression Add Intel-QAT based QATZSTD compression Dec 11, 2023
@rschu1ze rschu1ze changed the title Add Intel-QAT based QATZSTD compression Add Intel-QAT-based QATZSTD compression codec Dec 11, 2023
.gitmodules Outdated Show resolved Hide resolved
contrib/CMakeLists.txt Outdated Show resolved Hide resolved
contrib/CMakeLists.txt Show resolved Hide resolved
contrib/CMakeLists.txt Outdated Show resolved Hide resolved
contrib/CMakeLists.txt Outdated Show resolved Hide resolved
src/Compression/CompressionFactory.cpp Outdated Show resolved Hide resolved
src/Compression/CompressionFactory.cpp Outdated Show resolved Hide resolved
src/Compression/CompressionCodecQATZSTD.cpp Outdated Show resolved Hide resolved
src/Compression/CompressionCodecQATZSTD.cpp Outdated Show resolved Hide resolved
src/Compression/CompressionCodecQATZSTD.cpp Outdated Show resolved Hide resolved
contrib/CMakeLists.txt Outdated Show resolved Hide resolved
contrib/CMakeLists.txt Outdated Show resolved Hide resolved
src/Compression/CompressionCodecQATZSTD.cpp Outdated Show resolved Hide resolved
contrib/CMakeLists.txt Outdated Show resolved Hide resolved
contrib/qpl-cmake/CMakeLists.txt Outdated Show resolved Hide resolved
@rschu1ze rschu1ze added can be tested Allows running workflows for external contributors and removed can be tested Allows running workflows for external contributors manual approve Manual approve required to run CI labels Jan 8, 2024
@clickhouse-ci clickhouse-ci bot added the manual approve Manual approve required to run CI label Jan 8, 2024
@rschu1ze

This comment was marked as outdated.

@rschu1ze
Copy link
Member

rschu1ze commented Jan 9, 2024

Note to myself: Force-disable setting enable_zstd_qat_codec in ClickHouse Cloud, similar to setting enable_deflate_qpl_codec.

@rschu1ze rschu1ze merged commit 4cacfa6 into ClickHouse:master Jan 10, 2024
260 of 268 checks passed
@rschu1ze
Copy link
Member

rschu1ze commented Jan 10, 2024

@jinjunzh For validation and markeging purposes on your and our end, would you perhaps like to do some SQL-level benchmarks for ZSTD_DEFLATE? Asking because my dev machine doesn't have QuickAssist (or they disabled it - it's an EC2 box), and the benchmarks linked above look like microbenchmarks.

ClickBench is popular around here but SSB may also do the job. Most of the infrastructure seems already there, though some of it was removed in the slightly impulsive #56898 (please bring the scripts back as needed).

@rschu1ze

This comment was marked as outdated.

@rschu1ze
Copy link
Member

So I tried an in-tree build as my EC2 c7i instance has QuickAssist. This returned an error during insert into a ZSTDQAT-compressed table: <Warning> CompressionCodecZSTDQAT: Initialization of hardware-assisted ZSTD_QAT codec failed, falling back to software ZSTD codec -> status: -1.

I then tried an out-of-tree build using the documented steps (btw., is there any way to know if one needs an out-of-tree or an in-tree build? The log message is not very telling.). ./configure failed with zlib headers required, yet I had the headers installed (sudo apt install zlib1g zlib1g-dev). There was also no way to point the configure script manually to the zlib header directory.

@jinjunzh Any input would be appreciated. Also, do you know if newer kernels no longer require the QAT driver, starting with some kernel version?

@jinjunzh
Copy link
Contributor Author

jinjunzh commented Jan 23, 2024

@rschu1ze
For QAT setup, please refer to System Configuration
For zlib header issue, let me investigate it further.
For in-tree part, please refer to qat-2-0-in-tree-kernel-requirements

@jinjunzh
Copy link
Contributor Author

@jinjunzh For validation and markeging purposes on your and our end, would you perhaps like to do some SQL-level benchmarks for ZSTD_DEFLATE? Asking because my dev machine doesn't have QuickAssist (or they disabled it - it's an EC2 box), and the benchmarks linked above look like microbenchmarks.

ClickBench is popular around here but SSB may also do the job. Most of the infrastructure seems already there, though some of it was removed in the slightly impulsive #56898 (please bring the scripts back as needed).

Previously, I've verified insert performance on local E2E test which works as expected. I will try to use ClickBench and give feedback to u once complete.

@rschu1ze
Copy link
Member

Thanks. Compressing the hits csv/tsv/parquet file in ClickBench (section "Data Loading") with ZSTD vs. QATZST (possibly using different levels) should be fine.

@jinjunzh
Copy link
Contributor Author

@rschu1ze For zlib question, i can't reproduce your issue, could you find zlib.h in your system, such as "/usr/include/zlib.h" or "/usr/local/include/zlib.h" ?

@rschu1ze
Copy link
Member

@jinjunzh I followed the steps here until /.configure, which fails with

[...]
checking for unistd.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for deflate in -lz... yes
checking zlib version... not found
configure: error:

    zlib headers required.

I previously installed package zlib1g-dev for Ubuntu 22.04: https://packages.ubuntu.com/jammy/zlib1g-dev, please click List of files to see where the headers are installed.

@jinjunzh
Copy link
Contributor Author

jinjunzh commented Feb 1, 2024

@rschu1ze please look into your "/usr/include/zlib.h" and search zlib version as below:
#define ZLIB_VERSION "1.2.11"
It would be expected newer than 1.2.3 which is define in ./configure as below:
LIB_ZLIB_VER_REQ=1.2.3
Otherwise, it fails with "zlib version... not found" as you met. If so, I guess you need install newer zlib from source.

@rschu1ze
Copy link
Member

rschu1ze commented Feb 1, 2024

@jinjunzh My /usr/include/zlib.h includes #define ZLIB_VERSION "1.2.11" which is recent enough. Weird. Anyways, in case I need to check or add something further, I would setup myself a fresh EC2 instance with the latest Ubuntu. Perhaps that will resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can be tested Allows running workflows for external contributors manual approve Manual approve required to run CI pr-feature Pull request with new product feature submodule changed At least one submodule changed in this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants