clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

[client-v2] Native Protocol: Handshake, Ping

Open chernser opened this issue 1 year ago • 5 comments

Describe the bug

Client V2 should support Native (on top of TCP) protocol.

TBD: More details description

chernser avatar Jul 08 '24 20:07 chernser

A basic question for native protocol implementation: are you going to use BIO or NIO?

pan3793 avatar Jul 16 '24 18:07 pan3793

Good day, @pan3793 ! I have no exact plan for the native protocol. We will try to use most optimal approach for native as well as for http. In general, yes, we will use NIO and NIO2 where possible.

chernser avatar Jul 18 '24 02:07 chernser

From my previous experience, NIO might be challenge. When bytes arrive in the socket recv buffer, it fires the callback method to decode the CH packet, but CH native protocol has no cheap way to detect if a packet(frame) is completed or not, the only way is to try the best effort to decode ...

pan3793 avatar Jul 18 '24 03:07 pan3793

@pan3793 I'm thinking to utilize netty for such things and I agree it might be a problem with buffers. However you may predict them well and minimize time of finding a frame.

chernser avatar Jul 19 '24 05:07 chernser

I did try to implement it using Netty and found such problems.

However you may predict them well and minimize time of finding a frame.

Looking forward to your implementation.

pan3793 avatar Jul 19 '24 05:07 pan3793