How is the underlying CQL native binary protocol implemented?

23 views
Skip to first unread message

joy

unread,
Dec 23, 2014, 11:24:42 PM12/23/14
to cpp-dri...@lists.datastax.com
Hi, I am curious about the underlying implementation of the CQL native binary protocol. It is also a RPC protocol, right? But how can it outperform thrift as they are both RPC protocol?
The Cassandra c++ driver has already implemented this native binary protocol, could anyone tell me which part of the source code is the core of the binary protocol?

Sorin Manolache

unread,
Dec 24, 2014, 4:37:51 AM12/24/14
to cpp-dri...@lists.datastax.com
On 2014-12-24 06:24, joy wrote:
> Hi, I am curious about the underlying implementation of the CQL native binary protocol. It is also a RPC protocol, right? But how can it outperform thrift as they are both RPC protocol?
> The Cassandra c++ driver has already implemented this native binary protocol, could anyone tell me which part of the source code is the core of the binary protocol?
>

I suppose it is faster because the native protocol is asynchronous. I.e.
the client may send a 2nd, 3rd etc request before the response of the
1st request arrives. So it supports pipelining. I don't know if it
supports out-of-order responses, i.e. if the response of the kth query
may arrive before the response of the nth query, k > n. I think yes but
I don't know.

Also I have the impression that the native frames are shorter than the
thrift frames that transport the same requests/responses. The native
protocol frame contains meta-data for the _heading_ of the table that is
sent in the response. The thrift frame contains meta-data for each
_cell_ of the table that is sent in the response.

For the implementation, have a look at query_request.hpp, response.hpp,
serialization.hpp, and connection.hpp.

Sorin
Reply all
Reply to author
Forward
0 new messages