-
Notifications
You must be signed in to change notification settings - Fork 16
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
Cassandra Websocket support #1215
Conversation
Good start! We can flesh out test coverage and perf in a different PR - Getting the shutdown logic sorted will be good to land this patch |
Alright, got the shutdown flow finished, just a couple error handling todos |
I think now the shutdown flow is handled this can merged as is, I've started modifying the test driver to let us send different types of Websocket messages that will let us test the error handling for that. But as it stands this PR has the MVP functionality. |
shotover-proxy/tests/test-configs/cassandra-passthrough-websocket/topology-encode.yaml
Show resolved
Hide resolved
in terms of API, we could make it a field like |
This is pretty cool work! In order to make use of this in a meaningful way I imagine we'll want to modify an existing driver to get all the driver features one would expect. Also, have you considered wrapping websockets such that they can be exposed as a tokio AsyncRead/AsyncWrite? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
I did look into that a bit before starting but the changes would need a fair bit of work to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!
The objective of this PR is to add support for CQL over Websockets through Shotover. That means having a Websocket listener on Shotover that a compatible driver can send CQL messages to and have Shotover pass these messages to Cassandra through the traditional TCP socket, receive the responses and return it over the Websocket protocol to the client.
At the moment the only instance of this in the wild is an experiment from last year by the Scylla team that is not in production: https://www.scylladb.com/2022/08/11/scylladb-student-projects-cql-over-websocket/.
I am using the
tokio-tungstenite
library which handles all the websocket internals and lets us just feed the data of a binary Websocket message (which will be raw Cassandra protocol bytes) into our codecs. I also make use of theSec-WebSocket-Protocol
header to specify"cql"
as the sub-protocol being used. Some examples of other database technologies using this: https://www.iana.org/assignments/websocket/websocket.xml.To test this I began work on a simple Cassandra driver: https://github.com/conorbros/cql-ws
The design for configuring the Websocket listener in the
topology.yaml
is as follows, open to other suggestions as I just went with the simplest one to start with.Moving forward: