SlideShare a Scribd company logo
1 of 34
How to be successful
with Scylla
Glauber Costa, VP Field Engineering
Presenter
Glauber Costa, VP Field Engineering
Glauber Costa is VP of Field Engineering at ScyllaDB. He shares
his time between the engineering department working on
upcoming Scylla features and helping customers succeed.
Before ScyllaDB, Glauber worked with Virtualization in the Linux
Kernel for 10 years, with contributions ranging from the Xen
Hypervisor to all sorts of guest functionality and containers.
Scylla is compatible with
other databases
Welcome Cassandra users
What to remember, what to forget?
■ Remember: Data model and consistency issues.
■ Forget: Operational best practices
● Users insist on tuning the system in the exact way as before
● Many times a change was done to work around an issue.
● Issue may not exist in Scylla
■ Example: compactions being too slow, compactions being too fast, etc.
Corollary: comparing databases
Wrong way to compare databases:
■ I will now run Scylla the same way I ran Cassandra for the past 5 years
● It will work.
● It will be suboptimal.
Right way to compare databases:
■ This is the work that I need to do, and this is how much it costs me
● Run each offering in their operational sweet spot.
General useful advice
Always monitor
Use an updated version
■ Policy is that only two versions receive updates.
■ For enterprise:
● 2019.1 and 2018.1 supported
■ For Open Source: 3.1 is released:
● 3.0 and 3.1 are supported
● 2.3 is EOLd
■ It’s fine to be conservative, but:
● Running 3.0 is conservative
● Running 2.3 is dangerous.
■ Patchlevel updates are very safe, do them.
● but don’t stream between minor versions.
Where to run it?
Hardware Selection
What is your bottleneck?
■ CPU
● Understand the per-core capacity of your workload
■ Storage
● Latency: NVMe
● Throughput: SSD
● Forget HDDs.
■ Network
● Forget anything below 1Gbps.
Storage layout
How to best organize many disks
■ RAID0
● Database is replicated, why mirror disks?
■ LVM (in striping mode)
Split commitlog and data?
■ Generally not worth it
● Can maybe help with overwrite heavy workloads
■ If you have super fast disks lying around that’s fine
Hardware Sizing
If you knew you’d need 1,000 USD in a trip, would you take 1,000 USD?
■ See Eyal’s presentation on how to size
● But then remember to add spare!
● Test your performance under bootstrap and decommission
● Make sure you know how long does it take to bootstrap and decommission
■ Asking us and estimates are not good enough: very data-model dependent
Packing the iron
In which situations should I run more, smaller nodes?
Packing the iron
In which situations should I run more, smaller nodes?
■ Never
Time to ingest. Dataset grows 2x as machine grows 2x.
Packing the iron
In which situations should I run more, smaller nodes?
■ Never - if choice is the same amount of resources
■ In practice, ok to smooth out expansion
32 cores
32 cores
32 cores
16 cores
16 cores
16 cores
16 cores
total 64
cores.
total 48 cores.
expansion
expansion
Configuration
Rack awareness
Run as many racks as you have replicas.
■ RF=3 and 3 Racks:
● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency
Rack 1
Rack 2
Rack 3
Replica 1
Replica2
Replica 3
Data
Rack awareness
Run as many racks as you have replicas.
■ RF=3 and 3 Racks:
● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency
rack failure:
1 copy gone.
QUORUM maintained.
Rack 1
Rack 2
Rack 3
Replica 1
Replica2
Replica 3
Data
Rack awareness
Run as many racks as you have replicas.
■ RF=3 and 3 Racks:
● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency
■ RF=3 and 2 Racks:
● Scylla will place a full copy in each rack and a third copy spread in both racks
■ Rack failure can lead to decreased HA: needed quorum is down
■ Rack failure can lead to data loss: two copies are lost.
Rack 1
Rack 2
Replica 1
Replica 2
Replica 3
Data
Rack awareness
Run as many racks as you have replicas.
■ RF=3 and 3 Racks:
● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency
■ RF=3 and 2 Racks:
● Scylla will place a full copy in each rack and a third copy spread in both racks
■ Rack failure can lead to decreased HA: needed quorum is down
■ Rack failure can lead to data loss: two copies are lost.
Rack failure, Scenario 1:
QUORUM maintained
Rack 1
Rack 2
Replica 1
Replica 2
Replica 3
Data
Rack awareness
Run as many racks as you have replicas.
■ RF=3 and 3 Racks:
● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency
■ RF=3 and 2 Racks:
● Scylla will place a full copy in each rack and a third copy spread in both racks
■ Rack failure can lead to decreased HA: needed quorum is down
■ Rack failure can lead to data loss: two copies are lost.
Rack 1
Rack 2
Replica 1
Replica 2
Replica 3
Data
Rack failure, Scenario 2:
You may have lost your
job.
Rack awareness
Run as many racks as you have replicas.
■ RF=3 and 3 Racks:
● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency
■ RF=3 and 2 Racks:
● Scylla will place a full copy in each rack and a third copy spread in both racks
■ Rack failure can lead to decreased HA: needed quorum is down
■ Rack failure can lead to data loss: two copies are lost.
■ All conditioned to NetworkTopologyStrategy
■ When expanding the cluster, add 3 nodes
Run the setup tool
scylla_setup is constantly updated with knowledge of what’s important
■ If I had to choose one configuration to always enforce:
● SET_NIC_AND_DISKS=yes
● SET_NIC in older versions
■ What does that do:
Scylla
CPU time
Linux
SoftIRQ
time
Scylla
CPU time
Scylla
CPU time OR
Run the setup tool
scylla_setup is constantly updated with knowledge of what’s important
■ If I had to choose one configuration to always enforce:
● SET_NIC_AND_DISKS=yes
● SET_NIC in older versions
■ Not yet in setup:
● Taking timestamps
■ TSC clocksource: 26ns
■ Xen clocksource: 100ns
$ cat /sys/devices/system/clocksource/clocksource0/available_clocksource
xen
Love thy data
Prepare your statements
Ad-hoc, rare queries are the only excuse not to prepare statements.
Partition sizing
Large partitions per se are (almost) not a problem anymore.
■ SELECT * from table where pk = ? and ck = ? OK
■ SELECT * from table where pk = ? That’s the issue
Partition distribution
Bad partition distribution are not a unique Scylla issue
■ But they can show up sooner in Scylla due to shards.
● That’s a good thing
Understand the caching basics
■ Cache is LRU on rows
● Use BYPASS CACHE for analytical workloads
■ Careful with moving range queries
● SELECT * from time_series where pk = ? and time >= past and time >= now; BAD
● SELECT * from time_series where pk = ? and time >= past;
GOOD
Control parallelism
■ Low parallelism hurts Scylla
● Fewer units will be working, database will not be efficient
■ Is there such a thing as too high?
Control parallelism
■ Infinite parallelism is asking for trouble
● I don’t mean ∞
● 4 trillion concurrent requests is infinite in the real world
■ No need to guess:
● C = T x L
● Example: 200,000 requests/s at 10ms average latency:
■ C = 200,000 * 0.001
■ C = 2,000.
■ Driver settings:
● Number of connections x maximum requests per connection
● Remaining requests will be queued in the application side.
Be very careful with retries
■ If client timeout < server timeout:
● effectively increase parallelism
● Know the difference between reads, range reads, writes, etc.
■ Be very careful with speculative retry
● Remember it will be retried in the same replica set that just took long to respond
● Now it will take even longer because of the extra request
■ And more speculative retries.
Batching writes
Should writes be batched?
■ Latency of the operation is the latency of the batch
● Therefore it may fail.
■ Scylla is token aware, shard aware
● Batches may break that
● Summary: only batch updates to the same partition
Thank you Stay in touch
Any questions?
Glauber Costa
glauber@scylladb.com
@glcst

More Related Content

What's hot

Sga internals
Sga internalsSga internals
Sga internals
sergkosko
 

What's hot (20)

Log Structured Merge Tree
Log Structured Merge TreeLog Structured Merge Tree
Log Structured Merge Tree
 
Scylla Summit 2022: Making Schema Changes Safe with Raft
Scylla Summit 2022: Making Schema Changes Safe with RaftScylla Summit 2022: Making Schema Changes Safe with Raft
Scylla Summit 2022: Making Schema Changes Safe with Raft
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
 
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group ReplicationPercona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
Linux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQLLinux and H/W optimizations for MySQL
Linux and H/W optimizations for MySQL
 
Cassandra at Instagram (August 2013)
Cassandra at Instagram (August 2013)Cassandra at Instagram (August 2013)
Cassandra at Instagram (August 2013)
 
Nick Fisk - low latency Ceph
Nick Fisk - low latency CephNick Fisk - low latency Ceph
Nick Fisk - low latency Ceph
 
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte DataProblems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
Problems with PostgreSQL on Multi-core Systems with MultiTerabyte Data
 
Cassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patternsCassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patterns
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
 
Ceph and RocksDB
Ceph and RocksDBCeph and RocksDB
Ceph and RocksDB
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability Practices
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods
 
SmartDB Office Hours: Connection Pool Sizing Concepts
SmartDB Office Hours: Connection Pool Sizing ConceptsSmartDB Office Hours: Connection Pool Sizing Concepts
SmartDB Office Hours: Connection Pool Sizing Concepts
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
 
Sga internals
Sga internalsSga internals
Sga internals
 
Distributed load testing with k6
Distributed load testing with k6Distributed load testing with k6
Distributed load testing with k6
 
How Scylla Manager Handles Backups
How Scylla Manager Handles BackupsHow Scylla Manager Handles Backups
How Scylla Manager Handles Backups
 
MyRocks Deep Dive
MyRocks Deep DiveMyRocks Deep Dive
MyRocks Deep Dive
 

Similar to How to be Successful with Scylla

Scaling Cassandra for Big Data
Scaling Cassandra for Big DataScaling Cassandra for Big Data
Scaling Cassandra for Big Data
DataStax Academy
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
DataStax Academy
 
Cassandra overview
Cassandra overviewCassandra overview
Cassandra overview
Sean Murphy
 

Similar to How to be Successful with Scylla (20)

Retaining Goodput with Query Rate Limiting
Retaining Goodput with Query Rate LimitingRetaining Goodput with Query Rate Limiting
Retaining Goodput with Query Rate Limiting
 
Top 10 Perl Performance Tips
Top 10 Perl Performance TipsTop 10 Perl Performance Tips
Top 10 Perl Performance Tips
 
Retaining Goodput with Query Rate Limiting
Retaining Goodput with Query Rate LimitingRetaining Goodput with Query Rate Limiting
Retaining Goodput with Query Rate Limiting
 
Scaling Cassandra for Big Data
Scaling Cassandra for Big DataScaling Cassandra for Big Data
Scaling Cassandra for Big Data
 
Cpu Caches
Cpu CachesCpu Caches
Cpu Caches
 
CPU Caches - Jamie Allen
CPU Caches - Jamie AllenCPU Caches - Jamie Allen
CPU Caches - Jamie Allen
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
Backing up Wikipedia Databases
Backing up Wikipedia DatabasesBacking up Wikipedia Databases
Backing up Wikipedia Databases
 
cachegrand: A Take on High Performance Caching
cachegrand: A Take on High Performance Cachingcachegrand: A Take on High Performance Caching
cachegrand: A Take on High Performance Caching
 
Architectural Overview of MapR's Apache Hadoop Distribution
Architectural Overview of MapR's Apache Hadoop DistributionArchitectural Overview of MapR's Apache Hadoop Distribution
Architectural Overview of MapR's Apache Hadoop Distribution
 
Top 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark ApplicationsTop 5 Mistakes When Writing Spark Applications
Top 5 Mistakes When Writing Spark Applications
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
 
P99 Pursuit: 8 Years of Battling P99 Latency
P99 Pursuit: 8 Years of Battling P99 LatencyP99 Pursuit: 8 Years of Battling P99 Latency
P99 Pursuit: 8 Years of Battling P99 Latency
 
NoSQL Database Migration Masterclass - Session 3: Migration Logistics
NoSQL Database Migration Masterclass - Session 3: Migration LogisticsNoSQL Database Migration Masterclass - Session 3: Migration Logistics
NoSQL Database Migration Masterclass - Session 3: Migration Logistics
 
4 use cases for C* to Scylla
4 use cases for C*  to Scylla4 use cases for C*  to Scylla
4 use cases for C* to Scylla
 
ScyllaDB: NoSQL at Ludicrous Speed
ScyllaDB: NoSQL at Ludicrous SpeedScyllaDB: NoSQL at Ludicrous Speed
ScyllaDB: NoSQL at Ludicrous Speed
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
 
Making the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
Making the Most Out of ScyllaDB's Awesome Concurrency at OptimizelyMaking the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
Making the Most Out of ScyllaDB's Awesome Concurrency at Optimizely
 
Cassandra overview
Cassandra overviewCassandra overview
Cassandra overview
 

More from ScyllaDB

More from ScyllaDB (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
What Developers Need to Unlearn for High Performance NoSQL
What Developers Need to Unlearn for High Performance NoSQLWhat Developers Need to Unlearn for High Performance NoSQL
What Developers Need to Unlearn for High Performance NoSQL
 
Low Latency at Extreme Scale: Proven Practices & Pitfalls
Low Latency at Extreme Scale: Proven Practices & PitfallsLow Latency at Extreme Scale: Proven Practices & Pitfalls
Low Latency at Extreme Scale: Proven Practices & Pitfalls
 
Dissecting Real-World Database Performance Dilemmas
Dissecting Real-World Database Performance DilemmasDissecting Real-World Database Performance Dilemmas
Dissecting Real-World Database Performance Dilemmas
 
Beyond Linear Scaling: A New Path for Performance with ScyllaDB
Beyond Linear Scaling: A New Path for Performance with ScyllaDBBeyond Linear Scaling: A New Path for Performance with ScyllaDB
Beyond Linear Scaling: A New Path for Performance with ScyllaDB
 
Dissecting Real-World Database Performance Dilemmas
Dissecting Real-World Database Performance DilemmasDissecting Real-World Database Performance Dilemmas
Dissecting Real-World Database Performance Dilemmas
 
Database Performance at Scale Masterclass: Workload Characteristics by Felipe...
Database Performance at Scale Masterclass: Workload Characteristics by Felipe...Database Performance at Scale Masterclass: Workload Characteristics by Felipe...
Database Performance at Scale Masterclass: Workload Characteristics by Felipe...
 
Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...
Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...
Database Performance at Scale Masterclass: Database Internals by Pavel Emelya...
 
Database Performance at Scale Masterclass: Driver Strategies by Piotr Sarna
Database Performance at Scale Masterclass: Driver Strategies by Piotr SarnaDatabase Performance at Scale Masterclass: Driver Strategies by Piotr Sarna
Database Performance at Scale Masterclass: Driver Strategies by Piotr Sarna
 
Replacing Your Cache with ScyllaDB
Replacing Your Cache with ScyllaDBReplacing Your Cache with ScyllaDB
Replacing Your Cache with ScyllaDB
 
Powering Real-Time Apps with ScyllaDB_ Low Latency & Linear Scalability
Powering Real-Time Apps with ScyllaDB_ Low Latency & Linear ScalabilityPowering Real-Time Apps with ScyllaDB_ Low Latency & Linear Scalability
Powering Real-Time Apps with ScyllaDB_ Low Latency & Linear Scalability
 
7 Reasons Not to Put an External Cache in Front of Your Database.pptx
7 Reasons Not to Put an External Cache in Front of Your Database.pptx7 Reasons Not to Put an External Cache in Front of Your Database.pptx
7 Reasons Not to Put an External Cache in Front of Your Database.pptx
 
Getting the most out of ScyllaDB
Getting the most out of ScyllaDBGetting the most out of ScyllaDB
Getting the most out of ScyllaDB
 
NoSQL Database Migration Masterclass - Session 2: The Anatomy of a Migration
NoSQL Database Migration Masterclass - Session 2: The Anatomy of a MigrationNoSQL Database Migration Masterclass - Session 2: The Anatomy of a Migration
NoSQL Database Migration Masterclass - Session 2: The Anatomy of a Migration
 
NoSQL Data Migration Masterclass - Session 1 Migration Strategies and Challenges
NoSQL Data Migration Masterclass - Session 1 Migration Strategies and ChallengesNoSQL Data Migration Masterclass - Session 1 Migration Strategies and Challenges
NoSQL Data Migration Masterclass - Session 1 Migration Strategies and Challenges
 
ScyllaDB Virtual Workshop
ScyllaDB Virtual WorkshopScyllaDB Virtual Workshop
ScyllaDB Virtual Workshop
 
DBaaS in the Real World: Risks, Rewards & Tradeoffs
DBaaS in the Real World: Risks, Rewards & TradeoffsDBaaS in the Real World: Risks, Rewards & Tradeoffs
DBaaS in the Real World: Risks, Rewards & Tradeoffs
 
Build Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDBBuild Low-Latency Applications in Rust on ScyllaDB
Build Low-Latency Applications in Rust on ScyllaDB
 
NoSQL Data Modeling 101
NoSQL Data Modeling 101NoSQL Data Modeling 101
NoSQL Data Modeling 101
 
Top NoSQL Data Modeling Mistakes
Top NoSQL Data Modeling MistakesTop NoSQL Data Modeling Mistakes
Top NoSQL Data Modeling Mistakes
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

How to be Successful with Scylla

  • 1. How to be successful with Scylla Glauber Costa, VP Field Engineering
  • 2. Presenter Glauber Costa, VP Field Engineering Glauber Costa is VP of Field Engineering at ScyllaDB. He shares his time between the engineering department working on upcoming Scylla features and helping customers succeed. Before ScyllaDB, Glauber worked with Virtualization in the Linux Kernel for 10 years, with contributions ranging from the Xen Hypervisor to all sorts of guest functionality and containers.
  • 3. Scylla is compatible with other databases
  • 4. Welcome Cassandra users What to remember, what to forget? ■ Remember: Data model and consistency issues. ■ Forget: Operational best practices ● Users insist on tuning the system in the exact way as before ● Many times a change was done to work around an issue. ● Issue may not exist in Scylla ■ Example: compactions being too slow, compactions being too fast, etc.
  • 5. Corollary: comparing databases Wrong way to compare databases: ■ I will now run Scylla the same way I ran Cassandra for the past 5 years ● It will work. ● It will be suboptimal. Right way to compare databases: ■ This is the work that I need to do, and this is how much it costs me ● Run each offering in their operational sweet spot.
  • 8. Use an updated version ■ Policy is that only two versions receive updates. ■ For enterprise: ● 2019.1 and 2018.1 supported ■ For Open Source: 3.1 is released: ● 3.0 and 3.1 are supported ● 2.3 is EOLd ■ It’s fine to be conservative, but: ● Running 3.0 is conservative ● Running 2.3 is dangerous. ■ Patchlevel updates are very safe, do them. ● but don’t stream between minor versions.
  • 10. Hardware Selection What is your bottleneck? ■ CPU ● Understand the per-core capacity of your workload ■ Storage ● Latency: NVMe ● Throughput: SSD ● Forget HDDs. ■ Network ● Forget anything below 1Gbps.
  • 11. Storage layout How to best organize many disks ■ RAID0 ● Database is replicated, why mirror disks? ■ LVM (in striping mode) Split commitlog and data? ■ Generally not worth it ● Can maybe help with overwrite heavy workloads ■ If you have super fast disks lying around that’s fine
  • 12. Hardware Sizing If you knew you’d need 1,000 USD in a trip, would you take 1,000 USD? ■ See Eyal’s presentation on how to size ● But then remember to add spare! ● Test your performance under bootstrap and decommission ● Make sure you know how long does it take to bootstrap and decommission ■ Asking us and estimates are not good enough: very data-model dependent
  • 13. Packing the iron In which situations should I run more, smaller nodes?
  • 14. Packing the iron In which situations should I run more, smaller nodes? ■ Never Time to ingest. Dataset grows 2x as machine grows 2x.
  • 15. Packing the iron In which situations should I run more, smaller nodes? ■ Never - if choice is the same amount of resources ■ In practice, ok to smooth out expansion 32 cores 32 cores 32 cores 16 cores 16 cores 16 cores 16 cores total 64 cores. total 48 cores. expansion expansion
  • 17. Rack awareness Run as many racks as you have replicas. ■ RF=3 and 3 Racks: ● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency Rack 1 Rack 2 Rack 3 Replica 1 Replica2 Replica 3 Data
  • 18. Rack awareness Run as many racks as you have replicas. ■ RF=3 and 3 Racks: ● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency rack failure: 1 copy gone. QUORUM maintained. Rack 1 Rack 2 Rack 3 Replica 1 Replica2 Replica 3 Data
  • 19. Rack awareness Run as many racks as you have replicas. ■ RF=3 and 3 Racks: ● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency ■ RF=3 and 2 Racks: ● Scylla will place a full copy in each rack and a third copy spread in both racks ■ Rack failure can lead to decreased HA: needed quorum is down ■ Rack failure can lead to data loss: two copies are lost. Rack 1 Rack 2 Replica 1 Replica 2 Replica 3 Data
  • 20. Rack awareness Run as many racks as you have replicas. ■ RF=3 and 3 Racks: ● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency ■ RF=3 and 2 Racks: ● Scylla will place a full copy in each rack and a third copy spread in both racks ■ Rack failure can lead to decreased HA: needed quorum is down ■ Rack failure can lead to data loss: two copies are lost. Rack failure, Scenario 1: QUORUM maintained Rack 1 Rack 2 Replica 1 Replica 2 Replica 3 Data
  • 21. Rack awareness Run as many racks as you have replicas. ■ RF=3 and 3 Racks: ● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency ■ RF=3 and 2 Racks: ● Scylla will place a full copy in each rack and a third copy spread in both racks ■ Rack failure can lead to decreased HA: needed quorum is down ■ Rack failure can lead to data loss: two copies are lost. Rack 1 Rack 2 Replica 1 Replica 2 Replica 3 Data Rack failure, Scenario 2: You may have lost your job.
  • 22. Rack awareness Run as many racks as you have replicas. ■ RF=3 and 3 Racks: ● Scylla will place a full copy in each rack. Perfect balancing, perfect resiliency ■ RF=3 and 2 Racks: ● Scylla will place a full copy in each rack and a third copy spread in both racks ■ Rack failure can lead to decreased HA: needed quorum is down ■ Rack failure can lead to data loss: two copies are lost. ■ All conditioned to NetworkTopologyStrategy ■ When expanding the cluster, add 3 nodes
  • 23. Run the setup tool scylla_setup is constantly updated with knowledge of what’s important ■ If I had to choose one configuration to always enforce: ● SET_NIC_AND_DISKS=yes ● SET_NIC in older versions ■ What does that do: Scylla CPU time Linux SoftIRQ time Scylla CPU time Scylla CPU time OR
  • 24. Run the setup tool scylla_setup is constantly updated with knowledge of what’s important ■ If I had to choose one configuration to always enforce: ● SET_NIC_AND_DISKS=yes ● SET_NIC in older versions ■ Not yet in setup: ● Taking timestamps ■ TSC clocksource: 26ns ■ Xen clocksource: 100ns $ cat /sys/devices/system/clocksource/clocksource0/available_clocksource xen
  • 26. Prepare your statements Ad-hoc, rare queries are the only excuse not to prepare statements.
  • 27. Partition sizing Large partitions per se are (almost) not a problem anymore. ■ SELECT * from table where pk = ? and ck = ? OK ■ SELECT * from table where pk = ? That’s the issue
  • 28. Partition distribution Bad partition distribution are not a unique Scylla issue ■ But they can show up sooner in Scylla due to shards. ● That’s a good thing
  • 29. Understand the caching basics ■ Cache is LRU on rows ● Use BYPASS CACHE for analytical workloads ■ Careful with moving range queries ● SELECT * from time_series where pk = ? and time >= past and time >= now; BAD ● SELECT * from time_series where pk = ? and time >= past; GOOD
  • 30. Control parallelism ■ Low parallelism hurts Scylla ● Fewer units will be working, database will not be efficient ■ Is there such a thing as too high?
  • 31. Control parallelism ■ Infinite parallelism is asking for trouble ● I don’t mean ∞ ● 4 trillion concurrent requests is infinite in the real world ■ No need to guess: ● C = T x L ● Example: 200,000 requests/s at 10ms average latency: ■ C = 200,000 * 0.001 ■ C = 2,000. ■ Driver settings: ● Number of connections x maximum requests per connection ● Remaining requests will be queued in the application side.
  • 32. Be very careful with retries ■ If client timeout < server timeout: ● effectively increase parallelism ● Know the difference between reads, range reads, writes, etc. ■ Be very careful with speculative retry ● Remember it will be retried in the same replica set that just took long to respond ● Now it will take even longer because of the extra request ■ And more speculative retries.
  • 33. Batching writes Should writes be batched? ■ Latency of the operation is the latency of the batch ● Therefore it may fail. ■ Scylla is token aware, shard aware ● Batches may break that ● Summary: only batch updates to the same partition
  • 34. Thank you Stay in touch Any questions? Glauber Costa glauber@scylladb.com @glcst