By default the driver does not use any compression on connections.
It's possible to specify a preferred compression algorithm.
The driver will try using it, but if the database doesn't support it, it will fall back to no compression.

Available compression algorithms:

  • Snappy
  • LZ4

An example enabling Snappy compression algorithm:

extern crate scylla;
extern crate tokio;
use scylla::{Session, SessionBuilder};
use scylla::transport::Compression;
use std::error::Error;

async fn main() -> Result<(), Box<dyn Error>> {
    let uri = std::env::var("SCYLLA_URI")
        .unwrap_or_else(|_| "".to_string());

    let session: Session = SessionBuilder::new()