Support Async methods in ClickHouseConnection and ClickHouseCommand
See original GitHub issueDescription
Propose to support async operations in implementation of ClickHouseConnection
, ClickHouseCommand
. It should be easy as long as it uses TcpClient under the hood.
What should be done
We can add methods OpenAsync
, ConnectAsync
, ExecuteNonQueryAsync
and other methods as its done in System.Data.Common.DbConnection
, System.Data.Common.DbCommand
. In async implementation we can use existing SslStream.AuthenticateAsClient
, await TcpClient.ConnectAsync
and others.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to properly use async methods on SqlConnection and ...
I am porting some old ASP.NET code to .NET 4.5. I am used to using SqlConnection/SqlCommand/SqlDataReader the old fashioned way. Now I am ......
Read more >Asynchronous Programming - ADO.NET
The following methods were added in .NET Framework 4.5 to support asynchronous programming: DbConnection.OpenAsync.
Read more >How to wait for async method to complete?
The most important thing to know about async and await is that await doesn't wait for the associated call to complete. What await...
Read more >Automatically create non-async methods from async methods
Issue #7769 proposes auto-generating async methods from non-async ones (Foo -> FooAsync), but this is problematic as you need more information ...
Read more >Task asynchronous programming model
Learn when and how to use Task-based async programming, a simplified approach to asynchronous programming in C#.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for your answers! I will think about using ClickHouse.Client or creating PR to this one.
I’m not @killwort but it is not much sense to have async ADO.NET implementation for ClickHouse. This doesn’t give any significant benefits, at the same time async code may easily add hardly-reproducible issues.
ClickHouse is used for OLAP queries, and they rarely take less then hundreds ms. CH is not a transactional DB, it is not designed for many-many concurrent connections. If you have 100 concurrent queries, that’s already may be a problem for CH. At the same time, 100 locked threads (because of synchronous implementation) is a not a big deal for web app.
If you have many similar queries to CH, it makes sense simply to organize a cache on .NET side.