Take advantage of ScyllaDB’s wide column NoSQL features such as workload prioritization to balance the needs of OLTP and OLAP in the same cluster. Plus learn about the different compaction strategies and which one would be right for your workload. With additional insights on properly sizing your database and using open source tools for observability.
2. High Performance NoSQL Masterclass
Felipe Cardeneti Mendes
● Solution Architect at ScyllaDB
● Published Author
● Linux and Open Source enthusiast
3. High Performance NoSQL Masterclass
Agenda
● About ScyllaDB
● Getting started with NoSQL databases
● Deployment and Production Readiness
● Observability Tips and Tricks
5. High Performance NoSQL Masterclass
ScyllaDB Database Architecture
Horizontal & Vertical Scaling
Built in C++
(no Java overhead)
System and Data
Center Aware
Sharding Per Core Shard-Aware Drivers
Auto-Performance
Tuning
Network
Processor NUMA
Storage
Unique Close-to-Metal Architecture
11. High Performance NoSQL Masterclass
Modern Business Challenges
Keep CapEx
& OpEx in check
Reduce complexity
Scale as the
data grows
Queries in milliseconds
Leverage massive
amounts of data
Predictable, consistent
performance
14. High Performance NoSQL Masterclass
Workload Types
Decision Support
+ More complex queries - large amounts
+ Latency important but not critical
+ Seconds to hours
Fundamental business tasks
+ Simple queries
+ Latency critical
+ Milliseconds per transaction
OLAP
Time
Complexity
of
Query
Time
Complexity
of
Query
OLTP
15. High Performance NoSQL Masterclass
OLAP Characteristics
Main Characteristics
+ Bound Concurrency
+ Scans and aggregations
+ Rely on MapReduce paradigms
OLAP
Time
Complexity
of
Query
Examples
+ How many users are from the US?
+ How many Twitter posts happened in 2022?
+ Which devices haven’t communicated back
within the past 1 hour?
16. High Performance NoSQL Masterclass
OLTP Characteristics
Main Characteristics
+ Unbound Concurrency
+ Designed for speed and simplicity
+ Often user facing APIs
Examples
+ What’s the last time an user logged in?
+ What have been the last 10 temperature
measurements for a given device?
+ How many likes a given posting has?
Time
Complexity
of
Query
OLTP
17. High Performance NoSQL Masterclass
Why not both? Meet Workload Prioritization
100 shares
Ratio = 100:100 (1:1) means equal shares of
processing/resources to complete tasks
Ratio = 100:50 (2:1) means 2X as many shares of processing/resources
for Transactions to complete tasks compared to Analytics
100 shares
100 shares
50 shares
OLTP
OLAP
Which Task to Run
24. What is compaction?
LSM storage engine’s write path:
24
Hidden Gems
+ This technique of keeping sorted files and merging them is well-known and
often called Log-Structured Merge (LSM) Tree
+ Published in 1996, earliest popular application known is the Lucene search
engine, 1999
Characteristics
+ High performance write.
+ Immediately readable.
+ Reasonable performance for read.
25. What is a compaction strategy?
LSM storage engine’s write path:
25
▪ Which files to compact, and when?
▪ This is called the compaction strategy
▪ The goal of the strategy is low amplification:
○ Avoid read requests needing many sstables.
• read amplification
○ Avoid overwritten/deleted/expired data staying on disk.
○ Avoid excessive temporary disk space needs
• space amplification
○ Avoid compacting the same data again and again.
• write amplification
26. Which one to choose?
LSM storage engine’s write path:
26
Know your workload
28. It all starts with Data Modeling
LSM storage engine’s write path:
28
Do’s
+ Denormalize
+ Query oriented approach
+ High data distribution / cardinality
Dont’s
+ Create hotspots
+ Large partitions/rows/cells/collections/etc
+ Low cardinality tables/views/indexes
29. Test, test, test…!
LSM storage engine’s write path:
29
Unit Testing
+ Test your workload and access patterns in a Docker container
+ Use specialized stress tools to simulate workload
○ cassandra-stress
○ nosqlbench
○ YCSB
+ OBSERVE the results (more on that later)
30. Application Development
LSM storage engine’s write path:
30
Functional Testing
+ Use Prepared Statements
+ Configure your routing and load balancing policy correctly
○ DCAware and TokenAware policies
○ ShardAware Drivers if using ScyllaDB!
+ Make use of Asynchronous APIs
+ Ensure your client is NOT a bottleneck
+ Paging is important: Ensure you adjust it right
31. Test, test, test…!
LSM storage engine’s write path:
31
Readiness Testing
+ What’s the unreplicated data set size?
+ How many operations per second do I need to achieve?
○ Out of these, what are the reads vs writes distribution?
○ What’s the average payload size?
○ What are my latency requirements?
+ How many regions should it replicate to?
+ Do I need indexes or views to satisfy my queries?
+ What is/are the target deployment location(s)?
+ Is the use case growth predictable or unpredictable?
+ What are the data retention requirements?
+ Is the use case storage or CPU bound?
32. Oh mighty sizing…!
LSM storage engine’s write path:
32
A Sizing Exercise
+ 500k ops/sec with 1KB rows
+ 5TB data set size
+ P99 reads and writes < 10ms
+ Target deployment region: AWS
Simple Math
+ RF=3 / 6 nodes * 5TB = 2.5TB per node
+ 500k ops/sec / 12,5K ops/core = 40 physical cores
+ Result: 6 nodes of i4i.8xlarge
36. High Performance NoSQL Masterclass
Keep in touch!
Felipe Cardeneti Mendes
Solutions Architect
ScyllaDB
felipemendes@scylladb.co
m
Find me on LinkedIn