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

Use CH Buffer for HTTP out stream, add metrics for interfaces #56064

Merged
merged 45 commits into from
Jan 2, 2024

Conversation

yakov-olkhovskiy
Copy link
Member

Changelog category (leave one):

  • Improvement

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

Replace HTTP outgoing buffering based on std ostream with CH Buffer.
Add bytes counting metrics for interfaces.

closes #55576

@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-improvement Pull request with some product improvements label Oct 27, 2023
@robot-ch-test-poll1
Copy link
Contributor

robot-ch-test-poll1 commented Oct 27, 2023

This is an automated comment for commit db97764 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 checkThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ 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
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
Mergeable CheckChecks if all other necessary checks are successful✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
SQLTestThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ 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
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
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
SQLancerFuzzing tests that detect logical bugs with SQLancer tool❌ failure

@CheSema CheSema self-assigned this Nov 16, 2023
@yakov-olkhovskiy yakov-olkhovskiy added the can be tested Allows running workflows for external contributors label Dec 16, 2023
@CheSema
Copy link
Member

CheSema commented Dec 18, 2023

Some perf tests are failed. Interesting what is the reason.

@yakov-olkhovskiy
Copy link
Member Author

I guess because we had some problems with CI yesterday

throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Unsupported compression method");

std::unique_ptr<WriteBuffer> wrapWriteBufferWithCompressionMethod(
WriteBuffer * nested,
Copy link
Member

Choose a reason for hiding this comment

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

This looks dangerous.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is to support not owning version of WriteBufferDecorator where nested is decorated but not owned by decorator

LZMADeflatingWriteBuffer(
std::unique_ptr<WriteBuffer> out_,
WriteBufferT && out_,
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

LZMADeflatingWriteBuffer is inherited from WriteBufferWithOwnMemoryDecorator which is a specialization of WriteBufferDecorator and should now accommodate both owning and non-owning construction

@@ -5,5 +5,5 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../shell_config.sh

echo 'SELECT 1 FROM numbers(100)' |
${CLICKHOUSE_CURL_COMMAND} -v "${CLICKHOUSE_URL}&wait_end_of_query=1&send_progress_in_http_headers=0" --data-binary @- 2>&1 |
${CLICKHOUSE_CURL_COMMAND} -vs "${CLICKHOUSE_URL}&wait_end_of_query=1&send_progress_in_http_headers=0" --data-binary @- 2>&1 |
Copy link
Member

Choose a reason for hiding this comment

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

When you pass -s (--silent) option to curl, you should always also specify -S (not ignore errors).

@@ -7,7 +7,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)


CURL_OUTPUT=$(echo 'SELECT 1 + sleepEachRow(0.00002) FROM numbers(100000)' | \
${CLICKHOUSE_CURL_COMMAND} -v "${CLICKHOUSE_URL}&wait_end_of_query=1&send_progress_in_http_headers=0&max_execution_time=1" --data-binary @- 2>&1)
${CLICKHOUSE_CURL_COMMAND} -vs "${CLICKHOUSE_URL}&wait_end_of_query=1&send_progress_in_http_headers=0&max_execution_time=1" --data-binary @- 2>&1)
Copy link
Member

Choose a reason for hiding this comment

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

.

@@ -147,8 +147,8 @@ class TCPHandler : public Poco::Net::TCPServerConnection
* because it allows to check the IP ranges of the trusted proxy.
* Proxy-forwarded (original client) IP address is used for quota accounting if quota is keyed by forwarded IP.
*/
TCPHandler(IServer & server_, TCPServer & tcp_server_, const Poco::Net::StreamSocket & socket_, bool parse_proxy_protocol_, std::string server_display_name_);
TCPHandler(IServer & server_, TCPServer & tcp_server_, const Poco::Net::StreamSocket & socket_, TCPProtocolStackData & stack_data, std::string server_display_name_);
TCPHandler(IServer & server_, TCPServer & tcp_server_, const Poco::Net::StreamSocket & socket_, bool parse_proxy_protocol_, std::string server_display_name_, const ProfileEvents::Event & read_event_ = ProfileEvents::end(), const ProfileEvents::Event & write_event_ = ProfileEvents::end());
Copy link
Member

Choose a reason for hiding this comment

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

Event can be passed by value, and also we can use std::optional.

Copy link
Member Author

Choose a reason for hiding this comment

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

const & accommodates by value and I made defaults rather than optional to make changes less intrusive...

@@ -33,7 +33,9 @@ class PostgreSQLHandler : public Poco::Net::TCPServerConnection
TCPServer & tcp_server_,
bool ssl_enabled_,
Int32 connection_id_,
std::vector<std::shared_ptr<PostgreSQLProtocol::PGAuthentication::AuthenticationMethod>> & auth_methods_);
std::vector<std::shared_ptr<PostgreSQLProtocol::PGAuthentication::AuthenticationMethod>> & auth_methods_,
const ProfileEvents::Event & read_event_ = ProfileEvents::end(),
Copy link
Member

Choose a reason for hiding this comment

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

.

<< " clickhouse-client --query='SELECT 1' > result\n"
<< " clickhouse-client < query > result\n";
auto out = response.send();
out->write("There is no handle ");
Copy link
Member

Choose a reason for hiding this comment

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

There is also a nice thing - IO/Operators.h
(optional)

@alexey-milovidov
Copy link
Member

Wow, that's a huge improvement! This is really amazing!

23.11:

$ curl http://localhost:8123/ -d 'SELECT number FROM system.numbers_mt LIMIT 1000000000 FORMAT JSON' > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 31.5G    0 31.5G  100    65  1138M      2  0:00:32  0:00:28  0:00:04 1101M

This PR:

$ curl http://localhost:8123/ -d 'SELECT number FROM system.numbers_mt LIMIT 1000000000 FORMAT JSON' > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 31.5G    0 31.5G  100    65  3204M      6  0:00:10  0:00:10 --:--:-- 3185M

@yakov-olkhovskiy yakov-olkhovskiy merged commit 5633fb8 into master Jan 2, 2024
241 of 255 checks passed
@yakov-olkhovskiy yakov-olkhovskiy deleted the feature-server-iface-metrics branch January 2, 2024 15:17
lwz9103 added a commit to Kyligence/gluten that referenced this pull request Jan 3, 2024
liuneng1994 pushed a commit to apache/incubator-gluten that referenced this pull request Jan 3, 2024
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240103)

* [CH] Fix build due to ClickHouse/ClickHouse#56064

---------

Co-authored-by: kyligence-git <gluten@kyligence.io>
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-improvement Pull request with some product improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProfileEvents for the traffic (bytes) transmitted over server interfaces
5 participants