-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Performance Issue in ClickHouseBulkCopy #153
Comments
I don't think this makes a lot of sense as the types need to match exactly, otherwise ClickHouse will not be able to parse them (due to the way CH binary format works). I can certainly think about caching the
I can change |
Thank you for performance comparison - I will change the selection criteria then
P.S. maybe I can also cache table structure in BulkCopy object itself, will see |
thank. |
According to your suggestion, I used static connection to inject data in the database.
Currently, two additional requests are sent to the server for each BulkInsert:
Call Stack IS:
|
@mbtolou hi, how did you solve your problem? |
I could not solve the problem In version 6.7.1, the problem has decreased. I will reopen the issue to report again if it happens. |
@mbtolou Thank you for your answer! |
Do you use custom HttpClient, HttpClientHandler or IHttpClientFactory @ruslanen? I did indeed take measures to solve this, but it would still be possible to trigger it in certain circumstances |
@DarkWanderer yes, I use my own
For every query I create new
I use it because I had an error: "Session is locked by concurrent client" But I have updated |
Stack trace:
(still don't have a scenario to reproduce) |
Do you hold the |
My queries don't read the result from reader (it's just insert or create table queries).
Btw, @DarkWanderer could you give some advices about cancellation, please? |
Hi @ruslanen, @DarkWanderer, I am facing the same issue. Getting this exception as well. In order to get to the bottom of it I implemented a stopwatch and it seems the exception is thrown immediately. After reading some issue reports in this repo I am quite sure the error was always there, however I am only seeing it since version 6.7.1 which fixed an issue with the exception not being thrown correctly. As of now I am creating a new ClickHouseConnection for every Bulk Insert by
Do you think it would make sense to use a static HttpClient instead? The error reproduction is quite easy for me. I just need to create a high throughput scenario. I am now digging into two directions:
|
The driver for .net (.NET client for ClickHouse) (https://github.com/DarkWanderer/ClickHouse.Client) performs a select operation whenever there is a BulkCopy request (
ClickHouse.Client/ClickHouse.Client/Copy/ClickHouseBulkCopy.cs
Line 103 in 4794942
Suggested solution:
1 - Is it possible that in line 103 (
ClickHouse.Client/ClickHouse.Client/Copy/ClickHouseBulkCopy.cs
Line 103 in 4794942
2 - It is also possible to perform the select operation using the following syntax:
Performing the following select syntax
Takes ~2000(ms) to be completed, while the following syntax as an alternative:
Takes only 15-25 (ms) to be completed. How can this huge time difference be alleviated?
which seems to perform the select operation much faster compared to the limit 0 syntax.
The text was updated successfully, but these errors were encountered: