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

How Async_inserts option works using clickhouse-http-client (JAVA) #967

Closed
usmanq8 opened this issue Jun 24, 2022 · 3 comments
Closed

How Async_inserts option works using clickhouse-http-client (JAVA) #967

usmanq8 opened this issue Jun 24, 2022 · 3 comments
Labels

Comments

@usmanq8
Copy link

usmanq8 commented Jun 24, 2022

I was going thru following link and came across ASYNC_INSERTS for http client.
Is this also true while using clickhouse-http-client. if yes, how we can enable it. Also i tried using server property to be enabled in DB's config file but it does not seems to work as intended. Am i missing some thing

https://clickhouse.com/blog/click-house-v2111-released

How can i monitor if async inserts are buffered and batched up using above property in INSERT cases.

@zhicwu
Copy link
Contributor

zhicwu commented Jun 24, 2022

Please refer to integration test at here. If you use v0.3.2-patch10, you may also want to enable load balancing - see details at here.

@ermadan
Copy link

ermadan commented Dec 8, 2022

@zhicwu Looks like the test code enables async in Jdbc API wich is not ideal for heavy inserts. Can you explain how to enable it for a pure http client with ClickHouseNode/ClickHouseClient.send?

@zhicwu
Copy link
Contributor

zhicwu commented Dec 11, 2022

Hi @ermadan, you can use ClickHouseRequest.option(ClickHouseHttpOption.CUSTOM_PARAMS, "async_insert=1,wait_for_async_insert=0") to enable async insert, and then use ClickHouseClient.send to execute the query. Alternatively, you can specify the settings in connection string like ClickHouseNode.of("http://HOST.clickhouse.cloud:8443/?user=default&password=PASSWORD&ssl=true&custom_http_params=async_insert=1,wait_for_async_insert=0").

If you don't want to be limited to http protocol or any client-side change, you may check here and use INSERT statement with settings or profile instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants