# ScyllaDB — NoSQL Data Store Compatible with Cassandra > ScyllaDB is a high-performance NoSQL database built on the Seastar framework. Drop-in compatible with Apache Cassandra and Amazon DynamoDB APIs but 10x faster thanks to its shard-per-core, shared-nothing architecture written in C++. ## Install Save in your project root: ## Quick Use ```bash # Docker (single node) docker run -d --name scylla -p 9042:9042 scylladb/scylla:latest \ --smp 2 --memory 2G --overprovisioned 1 # CQL shell docker exec -it scylla cqlsh ``` CQL (Cassandra Query Language — fully compatible): ```sql CREATE KEYSPACE tokrepo WITH replication = { "class": "NetworkTopologyStrategy", "datacenter1": 3 }; USE tokrepo; CREATE TABLE assets ( id uuid PRIMARY KEY, repo text, stars int, tags set, created_at timestamp ); INSERT INTO assets (id, repo, stars, tags, created_at) VALUES (uuid(), "react", 230000, { "frontend", "ui" }, toTimestamp(now())); SELECT * FROM assets; SELECT * FROM assets WHERE stars > 100000 ALLOW FILTERING; CREATE INDEX ON assets (repo); ``` ## Intro ScyllaDB is a distributed, wide-column NoSQL database that is drop-in compatible with Apache Cassandra (CQL protocol) and Amazon DynamoDB (via Scylla Alternator), but delivers 10x the throughput. Written in C++ on the Seastar framework with a shard-per-core, shared-nothing architecture and userspace network stack. Used at Discord, Expedia, Comcast, and Epic Games. - **Repo**: https://github.com/scylladb/scylladb - **Stars**: 15K+ - **Language**: C++ - **License**: AGPLv3 (Open Source) / commercial (Enterprise) ## What ScyllaDB Does - **CQL compatibility** — drop-in for Cassandra - **DynamoDB compatibility** — via Alternator - **Shard-per-core** — one thread per CPU core, no lock contention - **User-space I/O** — bypass kernel for networking and storage - **Workload prioritization** — classify and prioritize queries - **Incremental compaction** — avoid disk space amplification - **Materialized views** — auto-maintained denormalized tables - **LWT (lightweight transactions)** — Paxos-based linearizable operations - **Change Data Capture** — stream CDC events ## Architecture Built on Seastar (userspace C++ framework). Each CPU core owns a shard of data with no shared state — eliminating lock contention and context switching. Userspace TCP stack (DPDK optional) and direct I/O to disk. ## Self-Hosting ```yaml # 3-node cluster version: "3" services: scylla-node1: image: scylladb/scylla:latest command: --seeds=scylla-node1 --smp 4 --memory 8G scylla-node2: image: scylladb/scylla:latest command: --seeds=scylla-node1 --smp 4 --memory 8G scylla-node3: image: scylladb/scylla:latest command: --seeds=scylla-node1 --smp 4 --memory 8G ``` ## Key Features - Cassandra + DynamoDB wire compatibility - Shard-per-core architecture - Sub-millisecond P99 latency - Linear scaling - Workload prioritization - Incremental compaction - Materialized views - Change Data Capture - ScyllaDB Manager for ops - ScyllaDB Monitoring Stack ## Comparison | Database | Protocol | Architecture | Language | |---|---|---|---| | ScyllaDB | CQL + DynamoDB | Shard-per-core | C++ | | Cassandra | CQL | JVM threads | Java | | DynamoDB | DynamoDB API | Managed | Proprietary | | HBase | Custom | Region servers | Java | | Redis Cluster | RESP | Shard per node | C | ## 常见问题 FAQ **Q: 真的比 Cassandra 快 10x?** A: 在特定 benchmark 下是的。核心差异:C++ 无 GC、shard-per-core 无锁、userspace I/O。实际收益视工作负载而定。 **Q: 迁移 Cassandra 难吗?** A: 不难。CQL 协议和驱动兼容,数据格式相同。大部分项目几小时可迁移。 **Q: AGPLv3 限制?** A: 修改源码后如作为网络服务提供需开源改动部分。自用、嵌入应用不受影响。商业版有专业 support + 企业功能。 ## 来源与致谢 Sources - Docs: https://docs.scylladb.com - GitHub: https://github.com/scylladb/scylladb - License: AGPLv3 --- Source: https://tokrepo.com/en/workflows/0114254d-35f7-11f1-9bc6-00163e2b0d79 Author: AI Open Source