SlideShare a Scribd company logo
Piotr Sarna - Principal Software Engineer, ScyllaDB
Felipe Cardeneti Mendes - Solutions Architect, ScyllaDB
Andrew Brown - Director of Product Growth, ScyllaDB
Virtual Developer Workshop
Build Low-Latency
Applications in Rust on ScyllaDB
Presenters
2
Piotr Sarna
Piotr is a software engineer very keen on open-source projects, C++
and Rust.
Felipe Cardeneti Mendes
Felipe Mendes is an IT Specialist with years of experience with Linux. In
ScyllaDB, he works as a Solutions Architect
Andrew Brown
Andrew has been working with distributed systems in roles across
product development and product marketing.
Agenda ● Background: Why Rust, why ScyllaDB?
● The ScyllaDB Rust driver
● The Rust sample app walkthrough
● Profiling Rust performance
IOT Rust Application Setup
$ git clone https://github.com/fee-mendes/rust-driver-example/
$ cd rust-driver-example/docker-compose
$ docker-compose up -d
$ docker exec -it rust-app /bin/bash
Minimum requirements:
- Linux or OSX x86
- Docker installed and setup
- Quadcore CPU
- 2 GB of memory available
- Windows is not supported
Join the #rust-driver channel on ScyllaDB Slack to discuss any issues or questions you might have.
Low latency, close
to hardware schedulers
Perfect horizontal & Vertical scale
5
1000 Nodes Cluster
2000 Cluster
K8S Deployment
60TB per Node 256 Cores per Node
1B Operations
per Second
About ScyllaDB: Fast and Scalable
6
Poll:
How proficient are you with the
Rust language?
+ Asynchronous, non-blocking runtimes
+ Tokio: Most widely used Rust runtime
+ Seastar: C++ runtime for ScyllaDB
+ Fast, flexible, and reliable
+ Scalable, allows high concurrency and low latency
+ Green and sustainable
Why Rust? Why Tokio? Why ScyllaDB?
Rust Driver ScyllaDB
The effort started during a 2020 internal hackathon at ScyllaDB.
The existing CQL drivers (cassandra-cpp, cdrs) in the Rust ecosystem were not good
enough for us:
● Not fully async
● Unsatisfactory performance
● Not scalable enough
● Known, long-standing bugs
● No support for ScyllaDB-specific optimizations
○ e.g., Shard-per-core
● etc.
Some history
Our design goals:
● fully asynchronous
● token-aware, shard-aware
● ease of use
● maximizing performance
● minimizing overheads
● extensibility
● an extremely cool logo
Based on the principles above, we created the ScyllaDB Rust Driver.
Some history
● Most popular async runtime, which should translate to best adoption
● It would be tempting to write the driver in a runtime-agnostic way, but
it's hard:
○ Not all API's are well defined yet
○ Tokio offers quite complete support for TCP communication,
timeouts and other useful abstractions
● Very actively developed
Why Tokio?
Let’s Code
11
IOT Application Overview
Metric Collector Metric Reader UUID Finder
Write to ScyllaDB in parallel
Deploy schema (ks/tables)
Generate data:
100 devices
3 days
Every 5 minutes
Device metrics aggregator
Analytics sample
Split token-ring in small parts:
Efficient full table scan
token() function usage
BYPASS CACHE
Single device queries
Real-time sample
Partition scan:
MAX(), AVG(), MIN()
Range queries
Date/Time handling
Poll:
What databases do you use
(or are planning to use)
for Rust Apps?:
13
Profiling
14
tokio-console is a very cool project which brings perf/top capabilities to async Rust.
Prerequisites:
Installation:
$ cargo install tokio-console
Cargo.toml:
[dependencies]
console-subscriber = "0.1"
Code:
console_subscriber::init();
Compilation flags:
RUSTFLAGS="--cfg tokio_unstable" cargo run <your-project>
Profiling: tokio-console
Demo
Profiling: tokio-console
Rust ecosystem has a very convenient way of generating flamegraphs: cargo
flamegraph
Usage:
$ cargo install flamegraph
$ cargo flamegraph your-project
Profiling: cargo flamegraph
Demo
Profiling: cargo flamegraph
On Linux, flamegraph scripts use perf underneath. Perf is a well-known and very powerful
profiling tool with direct support in the kernel. Rust programs, since they're compiled via LLVM,
are perfectly capable candidates for profiling with perf.
Prerequisites:
Cargo.toml (the root one in case you use multiple workspaces):
[profile.release]
lto = false
debug = true
System (Linux-specific):
$ echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid
$ echo 0 | sudo tee /proc/sys/kernel/kptr_restrict
Profiling: perf
By the way, when run on Linux, cargo flamegraph leaves a side effect - a perf.data file,
which is a result format from calling perf record. Here's another example:
$ perf record -g ./target/release/metric-collector
$ perf report -g
Profiling: perf
Felipe Cardeneti
Mendes
felipemendes@scylladb.com
Piotr Sarna
sarna@scylladb.com
Q&A
Andrew Brown
andrew.brown@scylladb.com
United States
2445 Faber St, Suite #200
Palo Alto, CA USA 94303
Israel
Maskit 4
Herzliya, Israel 4673304
www.scylladb.com
@scylladb
Thank You!

More Related Content

PDF
jemalloc 세미나
PDF
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
PDF
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
PPTX
A Technical Introduction to WiredTiger
PDF
MongodB Internals
PDF
When Feature Flags Go Bad : How Not to Have Feature Flags Be Used Incorrectly...
PDF
Scalability, Availability & Stability Patterns
PPTX
Apache Flink and what it is used for
jemalloc 세미나
Tech Talk: RocksDB Slides by Dhruba Borthakur & Haobo Xu of Facebook
DBA Fundamentals Group: Continuous SQL with Kafka and Flink
A Technical Introduction to WiredTiger
MongodB Internals
When Feature Flags Go Bad : How Not to Have Feature Flags Be Used Incorrectly...
Scalability, Availability & Stability Patterns
Apache Flink and what it is used for

What's hot (20)

PPTX
The Volcano/Cascades Optimizer
PPTX
Understanding and tuning WiredTiger, the new high performance database engine...
PDF
Data Engineering 101
PDF
What's the time? ...and why? (Mattias Sax, Confluent) Kafka Summit SF 2019
PDF
MongoDB WiredTiger Internals
PDF
비트코인 소스 구조분석
PDF
How to build massive service for advance
PDF
초보자를 위한 Git & GitHub
PDF
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
PPTX
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
PDF
Consolidating MLOps at One of Europe’s Biggest Airports
PPTX
Squirreling Away $640 Billion: How Stripe Leverages Flink for Change Data Cap...
PPTX
Apache Flink Deep Dive
PPTX
From cache to in-memory data grid. Introduction to Hazelcast.
PPT
Introduction To Map Reduce
PPTX
Modern Linux Tracing Landscape
PDF
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
PDF
Streaming SQL for Data Engineers: The Next Big Thing?
PDF
A Technical Introduction to WiredTiger
PDF
Event Sourcing - Greg Young
The Volcano/Cascades Optimizer
Understanding and tuning WiredTiger, the new high performance database engine...
Data Engineering 101
What's the time? ...and why? (Mattias Sax, Confluent) Kafka Summit SF 2019
MongoDB WiredTiger Internals
비트코인 소스 구조분석
How to build massive service for advance
초보자를 위한 Git & GitHub
Optimizing Kubernetes Resource Requests/Limits for Cost-Efficiency and Latenc...
[NDC17] Kubernetes로 개발서버 간단히 찍어내기
Consolidating MLOps at One of Europe’s Biggest Airports
Squirreling Away $640 Billion: How Stripe Leverages Flink for Change Data Cap...
Apache Flink Deep Dive
From cache to in-memory data grid. Introduction to Hazelcast.
Introduction To Map Reduce
Modern Linux Tracing Landscape
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
Streaming SQL for Data Engineers: The Next Big Thing?
A Technical Introduction to WiredTiger
Event Sourcing - Greg Young
Ad

Similar to Build Low-Latency Applications in Rust on ScyllaDB (20)

PDF
Build Low-Latency Applications in Rust on ScyllaDB
PDF
Build Low-Latency Applications in Rust on ScyllaDB
PDF
ScyllaDB V Developer Deep Dive Series: Rust-Based Drivers and UDFs with WebAs...
PPTX
Optimizing Performance in Rust for Low-Latency Database Drivers
PDF
Build Low-Latency Rust Applications on ScyllaDB
PDF
DevEx | there’s no place like k3s
PDF
Embedded Rust
PDF
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
PDF
Flutter Vikings 2022 - Full Stack Dart
PPTX
Accelerate your development with Docker
PDF
Accelerate your software development with Docker
PDF
Using Docker For Development
PDF
Scylla Summit 2022: ScyllaDB Rust Driver: One Driver to Rule Them All
PPTX
Настройка окружения для кросскомпиляции проектов на основе docker'a
PDF
QConSF 2022 - Backends in Dart
PDF
Spark Summit EU 2015: Lessons from 300+ production users
PDF
Dependencies Managers in C/C++. Using stdcpp 2014
PDF
Scaleable PHP Applications in Kubernetes
PDF
State of Containers and the Convergence of HPC and BigData
PDF
Learning Rust the Hard Way for a Production Kafka + ScyllaDB Pipeline
Build Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDB
ScyllaDB V Developer Deep Dive Series: Rust-Based Drivers and UDFs with WebAs...
Optimizing Performance in Rust for Low-Latency Database Drivers
Build Low-Latency Rust Applications on ScyllaDB
DevEx | there’s no place like k3s
Embedded Rust
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Flutter Vikings 2022 - Full Stack Dart
Accelerate your development with Docker
Accelerate your software development with Docker
Using Docker For Development
Scylla Summit 2022: ScyllaDB Rust Driver: One Driver to Rule Them All
Настройка окружения для кросскомпиляции проектов на основе docker'a
QConSF 2022 - Backends in Dart
Spark Summit EU 2015: Lessons from 300+ production users
Dependencies Managers in C/C++. Using stdcpp 2014
Scaleable PHP Applications in Kubernetes
State of Containers and the Convergence of HPC and BigData
Learning Rust the Hard Way for a Production Kafka + ScyllaDB Pipeline
Ad

More from ScyllaDB (20)

PDF
Understanding The True Cost of DynamoDB Webinar
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
PDF
New Ways to Reduce Database Costs with ScyllaDB
PDF
Powering a Billion Dreams: Scaling Meesho’s E-commerce Revolution with Scylla...
PDF
Leading a High-Stakes Database Migration
PDF
Achieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
PDF
Securely Serving Millions of Boot Artifacts a Day by João Pedro Lima & Matt ...
PDF
How Agoda Scaled 50x Throughput with ScyllaDB by Worakarn Isaratham
PDF
How Yieldmo Cut Database Costs and Cloud Dependencies Fast by Todd Coleman
PDF
ScyllaDB: 10 Years and Beyond by Dor Laor
PDF
Reduce Your Cloud Spend with ScyllaDB by Tzach Livyatan
PDF
Migrating 50TB Data From a Home-Grown Database to ScyllaDB, Fast by Terence Liu
PDF
Vector Search with ScyllaDB by Szymon Wasik
PDF
Workload Prioritization: How to Balance Multiple Workloads in a Cluster by Fe...
PDF
Two Leading Approaches to Data Virtualization, and Which Scales Better? by Da...
PDF
Scaling a Beast: Lessons from 400x Growth in a High-Stakes Financial System b...
PDF
Object Storage in ScyllaDB by Ran Regev, ScyllaDB
PDF
Lessons Learned from Building a Serverless Notifications System by Srushith R...
PDF
A Dist Sys Programmer's Journey into AI by Piotr Sarna
Understanding The True Cost of DynamoDB Webinar
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
New Ways to Reduce Database Costs with ScyllaDB
Powering a Billion Dreams: Scaling Meesho’s E-commerce Revolution with Scylla...
Leading a High-Stakes Database Migration
Achieving Extreme Scale with ScyllaDB: Tips & Tradeoffs
Securely Serving Millions of Boot Artifacts a Day by João Pedro Lima & Matt ...
How Agoda Scaled 50x Throughput with ScyllaDB by Worakarn Isaratham
How Yieldmo Cut Database Costs and Cloud Dependencies Fast by Todd Coleman
ScyllaDB: 10 Years and Beyond by Dor Laor
Reduce Your Cloud Spend with ScyllaDB by Tzach Livyatan
Migrating 50TB Data From a Home-Grown Database to ScyllaDB, Fast by Terence Liu
Vector Search with ScyllaDB by Szymon Wasik
Workload Prioritization: How to Balance Multiple Workloads in a Cluster by Fe...
Two Leading Approaches to Data Virtualization, and Which Scales Better? by Da...
Scaling a Beast: Lessons from 400x Growth in a High-Stakes Financial System b...
Object Storage in ScyllaDB by Ran Regev, ScyllaDB
Lessons Learned from Building a Serverless Notifications System by Srushith R...
A Dist Sys Programmer's Journey into AI by Piotr Sarna

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PDF
cuic standard and advanced reporting.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Cloud computing and distributed systems.
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
cuic standard and advanced reporting.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
A Presentation on Artificial Intelligence
Unlocking AI with Model Context Protocol (MCP)
Digital-Transformation-Roadmap-for-Companies.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Cloud computing and distributed systems.
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Per capita expenditure prediction using model stacking based on satellite ima...
Advanced methodologies resolving dimensionality complications for autism neur...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Chapter 3 Spatial Domain Image Processing.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

Build Low-Latency Applications in Rust on ScyllaDB

  • 1. Piotr Sarna - Principal Software Engineer, ScyllaDB Felipe Cardeneti Mendes - Solutions Architect, ScyllaDB Andrew Brown - Director of Product Growth, ScyllaDB Virtual Developer Workshop Build Low-Latency Applications in Rust on ScyllaDB
  • 2. Presenters 2 Piotr Sarna Piotr is a software engineer very keen on open-source projects, C++ and Rust. Felipe Cardeneti Mendes Felipe Mendes is an IT Specialist with years of experience with Linux. In ScyllaDB, he works as a Solutions Architect Andrew Brown Andrew has been working with distributed systems in roles across product development and product marketing.
  • 3. Agenda ● Background: Why Rust, why ScyllaDB? ● The ScyllaDB Rust driver ● The Rust sample app walkthrough ● Profiling Rust performance
  • 4. IOT Rust Application Setup $ git clone https://github.com/fee-mendes/rust-driver-example/ $ cd rust-driver-example/docker-compose $ docker-compose up -d $ docker exec -it rust-app /bin/bash Minimum requirements: - Linux or OSX x86 - Docker installed and setup - Quadcore CPU - 2 GB of memory available - Windows is not supported Join the #rust-driver channel on ScyllaDB Slack to discuss any issues or questions you might have.
  • 5. Low latency, close to hardware schedulers Perfect horizontal & Vertical scale 5 1000 Nodes Cluster 2000 Cluster K8S Deployment 60TB per Node 256 Cores per Node 1B Operations per Second About ScyllaDB: Fast and Scalable
  • 6. 6 Poll: How proficient are you with the Rust language?
  • 7. + Asynchronous, non-blocking runtimes + Tokio: Most widely used Rust runtime + Seastar: C++ runtime for ScyllaDB + Fast, flexible, and reliable + Scalable, allows high concurrency and low latency + Green and sustainable Why Rust? Why Tokio? Why ScyllaDB? Rust Driver ScyllaDB
  • 8. The effort started during a 2020 internal hackathon at ScyllaDB. The existing CQL drivers (cassandra-cpp, cdrs) in the Rust ecosystem were not good enough for us: ● Not fully async ● Unsatisfactory performance ● Not scalable enough ● Known, long-standing bugs ● No support for ScyllaDB-specific optimizations ○ e.g., Shard-per-core ● etc. Some history
  • 9. Our design goals: ● fully asynchronous ● token-aware, shard-aware ● ease of use ● maximizing performance ● minimizing overheads ● extensibility ● an extremely cool logo Based on the principles above, we created the ScyllaDB Rust Driver. Some history
  • 10. ● Most popular async runtime, which should translate to best adoption ● It would be tempting to write the driver in a runtime-agnostic way, but it's hard: ○ Not all API's are well defined yet ○ Tokio offers quite complete support for TCP communication, timeouts and other useful abstractions ● Very actively developed Why Tokio?
  • 12. IOT Application Overview Metric Collector Metric Reader UUID Finder Write to ScyllaDB in parallel Deploy schema (ks/tables) Generate data: 100 devices 3 days Every 5 minutes Device metrics aggregator Analytics sample Split token-ring in small parts: Efficient full table scan token() function usage BYPASS CACHE Single device queries Real-time sample Partition scan: MAX(), AVG(), MIN() Range queries Date/Time handling
  • 13. Poll: What databases do you use (or are planning to use) for Rust Apps?: 13
  • 15. tokio-console is a very cool project which brings perf/top capabilities to async Rust. Prerequisites: Installation: $ cargo install tokio-console Cargo.toml: [dependencies] console-subscriber = "0.1" Code: console_subscriber::init(); Compilation flags: RUSTFLAGS="--cfg tokio_unstable" cargo run <your-project> Profiling: tokio-console
  • 17. Rust ecosystem has a very convenient way of generating flamegraphs: cargo flamegraph Usage: $ cargo install flamegraph $ cargo flamegraph your-project Profiling: cargo flamegraph
  • 19. On Linux, flamegraph scripts use perf underneath. Perf is a well-known and very powerful profiling tool with direct support in the kernel. Rust programs, since they're compiled via LLVM, are perfectly capable candidates for profiling with perf. Prerequisites: Cargo.toml (the root one in case you use multiple workspaces): [profile.release] lto = false debug = true System (Linux-specific): $ echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid $ echo 0 | sudo tee /proc/sys/kernel/kptr_restrict Profiling: perf
  • 20. By the way, when run on Linux, cargo flamegraph leaves a side effect - a perf.data file, which is a result format from calling perf record. Here's another example: $ perf record -g ./target/release/metric-collector $ perf report -g Profiling: perf
  • 22. United States 2445 Faber St, Suite #200 Palo Alto, CA USA 94303 Israel Maskit 4 Herzliya, Israel 4673304 www.scylladb.com @scylladb Thank You!