question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Async methods in ClickHouseConnection and ClickHouseCommand

See original GitHub issue

Description

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:open
  • Created a year ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mikhail-novikov-mindboxcommented, May 18, 2022

Thanks for your answers! I will think about using ClickHouse.Client or creating PR to this one.

1reaction
VitaliyMFcommented, May 18, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found