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

[client-v2] reader buffer optimization #1816

Merged
merged 6 commits into from
Sep 10, 2024
Merged

Conversation

chernser
Copy link
Contributor

@chernser chernser commented Sep 9, 2024

Summary

A lot small buffers may be allocated while reading numeric information.
This PR implements a reusing buffers withing a reader. It is not a default behavior.
Introduced Client.Builder#allowBinaryReaderToReuseBuffers to control the behavior

Note:

  • implementation is not thread-safe
  • reader should be called by one thread at a time
  • small buffers will 64 bytes are pre-allocated

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https:/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@chernser chernser added this to the 0.7.0 milestone Sep 9, 2024
Copy link

sonarcloud bot commented Sep 9, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
60.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link
Contributor

@mzitnik mzitnik left a comment

Choose a reason for hiding this comment

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

I do not see tests that enable the flag client_allow_binary_reader_to_reuse_buffers

@chernser
Copy link
Contributor Author

I do not see tests that enable the flag client_allow_binary_reader_to_reuse_buffers

I've added client-v2/src/test/java/com/clickhouse/client/query/BinaryReadyReusesBuffersTests.java that overrides QueryTests and sets client_allow_binary_reader_to_reuse_buffers

@chernser chernser merged commit dfb161b into main Sep 10, 2024
59 of 60 checks passed
@chernser chernser deleted the clientv2_buffer_optimization branch September 10, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants