Skip to content

Utilizing a Shared Parsing Pool for Multiple Parquet Streams#66253

Closed
Clark0 wants to merge 5 commits intoClickHouse:masterfrom
Clark0:shared-thread-pool-parquet
Closed

Utilizing a Shared Parsing Pool for Multiple Parquet Streams#66253
Clark0 wants to merge 5 commits intoClickHouse:masterfrom
Clark0:shared-thread-pool-parquet

Conversation

@Clark0
Copy link
Contributor

@Clark0 Clark0 commented Jul 9, 2024

Changelog category (leave one):

  • Performance Improvement

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

Utilizing a Shared Parsing Pool for Multiple Parquet Streams, fix #65963

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/

CI Settings (Only check the boxes if you know what you are doing):

  • Allow: All Required Checks
  • Allow: Stateless tests
  • Allow: Stateful tests
  • Allow: Integration Tests
  • Allow: Performance tests
  • Allow: All Builds
  • Allow: batch 1, 2 for multi-batch jobs
  • Allow: batch 3, 4, 5, 6 for multi-batch jobs

  • Exclude: Style check
  • Exclude: Fast test
  • Exclude: All with ASAN
  • Exclude: All with TSAN, MSAN, UBSAN, Coverage
  • Exclude: All with aarch64, release, debug

  • Do not test
  • Woolen Wolfdog
  • Upload binaries for special builds
  • Disable merge-commit
  • Disable CI cache

@Clark0
Copy link
Contributor Author

Clark0 commented Jul 9, 2024

generate test files, 1 file with 50 row groups and 3 files with 2 row groups

clickhouse local -q "select number as num, concat('Str: ', toString(number)) as str, [number, number + 1] as arr from numbers(50000000) format Parquet SETTINGS output_format_parquet_row_group_size=1000000" > ./file_1.parquet

clickhouse local -q "select number as num, concat('Str: ', toString(number)) as str, [number, number + 1] as arr from numbers(2000000) format Parquet SETTINGS output_format_parquet_row_group_size=1000000" > ./file_2.parquet

clickhouse local -q "select number as num, concat('Str: ', toString(number)) as str, [number, number + 1] as arr from numbers(2000000) format Parquet SETTINGS output_format_parquet_row_group_size=1000000" > ./file_3.parquet

clickhouse local -q "select number as num, concat('Str: ', toString(number)) as str, [number, number + 1] as arr from numbers(2000000) format Parquet SETTINGS output_format_parquet_row_group_size=1000000" > ./file_4.parquet
clickhouse local --time -q "SELECT * FROM file('./file_*.parquet', Parquet) FORMAT Null SETTINGS max_parsing_threads=8"

Before 2.408 s
After 0.827 s

Copy link
Member

Choose a reason for hiding this comment

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

Please take a look at IO/SharedThreadPools.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, just checked IO/SharedThreadPool, the idea is different. This SharedParsingThreadPool is to replace the individual thread pools opened by each ParquetBlockInputFormat.

@nikitamikhaylov nikitamikhaylov added the can be tested Allows running workflows for external contributors label Jul 9, 2024
@robot-clickhouse robot-clickhouse added the pr-performance Pull request with some performance improvements label Jul 9, 2024
@robot-clickhouse
Copy link
Member

robot-clickhouse commented Jul 9, 2024

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

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

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❌ 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
Successful checks
Check nameDescriptionStatus
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe 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. Integration 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
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ 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

@alexey-milovidov
Copy link
Member

@Clark0, a test for Delta Lake has failed.

@Clark0 Clark0 force-pushed the shared-thread-pool-parquet branch 2 times, most recently from 48de35a to 3214911 Compare July 16, 2024 06:17
@Clark0 Clark0 marked this pull request as draft July 17, 2024 02:57
@Clark0 Clark0 force-pushed the shared-thread-pool-parquet branch 2 times, most recently from 6a602ab to e63b74e Compare July 18, 2024 11:26
@Clark0 Clark0 marked this pull request as ready for review July 19, 2024 02:52
@Clark0 Clark0 force-pushed the shared-thread-pool-parquet branch from 0ab0d85 to 71a4fe9 Compare July 19, 2024 07:59
@Clark0
Copy link
Contributor Author

Clark0 commented Jul 22, 2024

@Clark0, a test for Delta Lake has failed.

Hi Alexey, most of the test cases are fixed. Do the remaining failed cases relate to this change?

@alexey-milovidov
Copy link
Member

02884_async_insert_skip_settings

It was fixed recently in the master. Let's merge with the master and ensure all the checks are green.

@Clark0 Clark0 force-pushed the shared-thread-pool-parquet branch from 71a4fe9 to 294a88e Compare July 23, 2024 02:21
SharedParsingThreadPool(size_t max_threads_, size_t num_streams_)
: max_threads(max_threads_), num_streams(num_streams_)
{
threads_per_stream = std::max(1ul, max_threads / std::max(num_streams, 1ul));
Copy link
Member

Choose a reason for hiding this comment

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

Move implementations to .cpp

@clickhouse-gh
Copy link
Contributor

clickhouse-gh bot commented Feb 18, 2025

Dear @antonio2368, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@clickhouse-gh
Copy link
Contributor

clickhouse-gh bot commented Jun 24, 2025

Dear @al13n321, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@al13n321
Copy link
Member

Obsoleted by #80931

@al13n321 al13n321 closed this Jun 28, 2025
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 pr-performance Pull request with some performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Distributing Workloads More Evenly Between Parquet Pipes

6 participants