Skip to main content

Overview

The ScyllaDB Rust Driver is a client-side driver for ScyllaDB written in pure Rust with a fully async API using Tokio. Although optimized for ScyllaDB, the driver is also compatible with Apache Cassandra®.
The driver is considered production ready and is actively maintained by the ScyllaDB team.

Key Features

The driver provides a comprehensive set of features for working with ScyllaDB and Cassandra:

Performance Optimizations

  • Asynchronous API - Built on Tokio for high-performance async operations
  • Token-aware routing - Queries are routed to the optimal node
  • Shard-aware routing - ScyllaDB-specific optimization for better performance
  • Tablet-aware routing - Support for ScyllaDB’s tablet-based architecture
  • Zero-copy deserialization - Minimal memory allocations for better performance

Type Safety

  • Type-safe serialization and deserialization - Compile-time guarantees for query parameters and results
  • Derive macros - Automatic implementation of serialization traits for user structs
  • CQL type mapping - Native Rust types map directly to CQL types

Query Capabilities

  • Multiple statement types - Simple, prepared, and batch statements
  • Query paging - Both automatic and manual paging support
  • Streaming results - Process large result sets with query_iter and execute_iter
  • CachingSession - Transparently prepares and caches statements

Advanced Features

Execution Profiles

Configure different execution policies for different query types

Load Balancing

Pluggable load balancing policies with sensible defaults

Retry Policies

Configurable retry behavior for failed queries

Speculative Execution

Send queries to multiple nodes to reduce tail latency

Security and Reliability

  • TLS Support - Both OpenSSL and Rustls implementations
  • Authentication - Built-in support for password authentication
  • Compression - LZ4 and Snappy compression algorithms
  • Driver-side metrics - Monitor query performance and errors
  • CQL tracing - Debug query execution with detailed tracing information

Architecture

All driver activity revolves around the Session object, which represents a connection pool to your ScyllaDB or Cassandra cluster:
use scylla::client::session::Session;
use scylla::client::session_builder::SessionBuilder;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let session: Session = SessionBuilder::new()
        .known_node("127.0.0.1:9042")
        .build()
        .await?;

    // Use the session to execute queries
    Ok(())
}
The Session object is:
  • Thread-safe - Can be safely shared across threads
  • Connection-pooled - Maintains connections to all nodes in the cluster
  • Topology-aware - Automatically discovers cluster topology
  • Self-healing - Reconnects to nodes that become available

Minimum Requirements

Minimum Supported Rust Version (MSRV): 1.85.0
The driver requires:
  • Rust 1.85.0 or later
  • Tokio runtime (version 1.40 or later)
  • ScyllaDB 4.0+ or Apache Cassandra 3.0+ (CQL protocol version 4)

Version Support Policy

The driver follows a stable versioning policy:
  • Major versions won’t be released more frequently than every 9 months
  • Minor versions may include new features but won’t break existing APIs
  • Patch versions contain only bug fixes
  • Previous major versions receive bugfixes for a period after new major releases
Changes to MSRV can happen in major and minor releases, but not in patch releases. The MSRV will not be bumped to a Rust version that was released less than 6 months ago.

License

The ScyllaDB Rust Driver is dual-licensed under:
  • Apache License, Version 2.0
  • MIT License
You may choose either license at your option.

Next Steps

Quickstart

Build your first application with the ScyllaDB Rust Driver

Installation

Learn how to add the driver to your project

Build docs developers (and LLMs) love