Getting started with AWS DynamoDB™ is famously easy, but as an application grows and evolves it often starts to struggle with DynamoDB’s limitations. We introduce Scylla’s Alternator, which provides the same API as DynamoDB but aims to empower the application developer. In this presentation we will survey some of Alternator’s developer-centered features: Alternator lets you test and eventually deploy your application anywhere, on any public cloud or private cluster. It efficiently supports multiple tables so it does not require difficult single-table design. Finally, Alternator provides the developer with strong observability tools. The insights provided by these tools can detect bottlenecks, improve performance and even lower its cost.
2. Nadav Har’El
Distinguished Engineer, ScyllaDB
Nadav Har'El has had a diverse 25-year career in computer programming and
computer science. In the past he worked on scientific computing,
networking software, information retrieval, virtualization and operating
systems. Today he works on Scylla, and among other things led the
Alternator development.
2
4. Easy to get started
▪ Nothing to install or set up
• Managed service on a popular cloud provider (AWS)
▪ Simple API: HTTP and JSON
▪ Bindings for many programming languages
▪ Simple data model (key/value, value is a document)
▪ Use the same service for prototyping and production
• Automatic scaling
• Unlimited scale
4
5. Easy to get started
▪ Nothing to install or set up
• Managed service on a popular cloud provider (AWS)
▪ Simple API: HTTP and JSON
▪ Bindings for many programming languages
▪ Simple data model (key/value, value is a document)
▪ Use the same service for prototyping and production
• Automatic scaling
• Unlimited scale
5
Do these promises really hold up?
6. Same service prototype & production
▪ You may want to deploy on AWS but develop locally.
• Amazon provides “DynamoDB Local”
• But it is not identical to the regular service
• Its features are a bit different
• Performance characteristics are very different
▪ You may want to deploy on different cloud vendors.
Or in a private data center.
You can’t
6
7. Introducing Alternator
Alternator:
Scylla’s DynamoDB-compatible implementation
▪ Open Source software.
▪ Can be installed anywhere!
• On your development laptop.
• On your private data center.
• At your clients’ private data centers.
• On any cloud. Including AWS of course.
▪ Develop and deploy on the same database implementation.
7
8. Introducing Alternator
Alternator is a new API in Scylla, and inherits Scylla’s
▪ Scalability to many nodes and many-core nodes.
▪ High throughput and consistently-low latencies.
▪ Production-quality NoSQL database that you can deploy anywhere.
▪ And also available as a managed service - Scylla Cloud.
8
9. Alternator Features
Aims at full DynamoDB API compatibility
▪ DynamoDB API server. HTTP / HTTPS, authentication.
▪ Table operations, CreateTable, DeleteTable, ListTables.
▪ Item operations: GetItem, PutItem, UpdateItem, BatchGetItem, BatchWriteItem
▪ Fully-consistent and eventually-consistent reads.
▪ Consistent (linearized) read-modify-write operations.
▪ All attribute types, including nested documents.
▪ Scans (Scan, Query) and filters.
▪ Secondary indexes (GSI and LSI).
▪ Global tables (currently all tables are global).
▪ Streams (changed data capture).
▪ Load balancer.
9
10. Simple data model?
Single Table Design
What DynamoDB says:
“You should maintain as few tables as possible in a DynamoDB
application. Most well designed applications require only one table.”
What users think of it:
“Doing @dynamodb single-table design is like solving a
Rubik's Cube by giving instructions to a blindfolded rock.”
- tweet
10
12. Single-table design
▪ Even single table design has multiple tables -
• Base table and multiple GSIs.
▪ DynamoDB requires seperate provisioning for each.
▪ Separate over-provisioning leads to wasted spare capacity
• Can be reduced by using auto-scaling of separate tables
• Doesn’t always help -
• Different queries using different tables/GSIs run at different times
• Wish to get cheaper prices with full-year provisioning
12
13. Single-table design
▪ Alternator supports multiple-table designs well.
▪ Tables share the same cluster - no need to provision
separately. Simpler and cheaper.
13
Multiple tables
(illustration)
14. Understanding performance
▪ As your DynamoDB application and workload
grow, you’ll usually run into performance bottlenecks:
• Hot partitions, large partitions, etc.
• Sub-optimal data modeling.
▪ These can lead to
• High latencies as requests get slow or throttled
• Extra costs. A lot of costs. The Million Dollar Engineering Problem.
▪ But how do we find these?
14
15. In DynamoDB
▪ You know how much you pay,
very little about why.
▪ AWS have internal tools
to find performance issues.
▪ You can combine a dozen
AWS products to capture all
activity and analyze it.
I'm not making this up...
15
The
Speaker’s
camera
displays
here
16. Observability in Alternator
▪ Alternator is fully under your control, and
exposes a lot of metrics and internal details
that can help diagnose problems and bottlenecks.
▪ The following mechanisms were developed in Scylla
originally for use for CQL, but now can be used in
Alternator for the DynamoDB API.
16
17. Observability in Alternator
▪ Monitoring stack
• Prometheus collects metrics
• Grafana visualization
• Alert manager, Advisor
▪ Hundreds of different metrics.
▪ Counters, rates, histograms, etc.
▪ Total, per node, per shard.
17
just a small part of the many detailed
dashboards in Scylla’s Grafana UI
20. Observability in Alternator
Hot partition detection via nodetool toppartitions:
▪ It samples write/read activity for chosen period,
and looks for most-used partitions:
20
WRITES Sampler:
Cardinality: ~5 (256 capacity)
Top 10 partitions:
Partition Count +/-
Russell Westbrook 100 0
Jermi Grant 25 0
Victor Oladipo 17 0
Andre Roberson 1 0
Steven Adams 1 0
22. Observability in Alternator
▪ Probabilistic request tracing:
• Sample requests with given probability, get timestamped trace
• Understand why queries are doing, or why they are slow
▪ GetItem trace (abbreviated, timestamps & IPs omitted):
22
Creating read executor for token 500909016482255315 with targets {127.0.0.1, 127.0.0.2}
read_data: querying locally
Start querying singular range {{500909016482255315,
pk{00144641375943583359474d4f393041313853445133}}}
read_digest: sending a message to /127.0.0.2
Querying cache for range {{500909016482255315,
pk{00144641375943583359474d4f393041313853445133}}}
Querying is done
read_digest: got response from /127.0.0.2
23. Observability in Alternator
Slow request tracing:
▪ Trace every request that is slower than a given
threshold.
▪ Slow queries are logged in a table, and can be
read from it.
The
Speaker’s
camera
displays
here
23
24. Conclusions
▪ Alternator is compatible with DynamoDB’s API
▪ It is Open Source and can be installed anywhere
• Your development machine
• Any public cloud
• Any private data center
▪ Multi-table applications are supported well
▪ Many observability features, for diagnosing performance
problems and unexpected costs
24
26. Download Scylla Open Source:
scylladb.com/download
Talk to an expert:
scylladb.com/consultation
Take a test drive:
scylladb.com/test-drive
Experience Scylla for Yourself
26
Editor's Notes
https://docs.scylladb.com/operating-scylla/nodetool-commands/toppartitions/
The cardinality of the sampled operations (number of unique operations in the sample set).
The number of partitions in a specified table that had the most traffic in a specified time period.