Deep Dive on DynamoDB
Pricing
Alex DeBrie
Principal, DeBrie Advisory
Why I love
DynamoDB's pricing.
DynamoDB's pricing …
DynamoDB's pricing …
■ is predictable.
Predictable pricing
■ "able to reason about in advance"
■ Can reason about your costs before building
■ Can see the impact of changes
DynamoDB's pricing …
■ is predictable.
DynamoDB's pricing …
■ is predictable.
■ is flexible.
Flexible pricing
■ Can scale capacity up + down to match traffic
■ Can switch between modes
You get all this with world-class reliability +
availability
DynamoDB's pricing …
■ is predictable.
■ is flexible.
DynamoDB's pricing …
■ is predictable.
■ is flexible.
■ has a tight feedback loop.
Tight feedback loop
■ Understand what's driving your costs
■ Adjust as needed
■ Tight integration between resource usage +
your costs
DynamoDB's pricing should
change how you build
applications.
Outline
■ Why I love DynamoDB's pricing model
■ Basics of DynamoDB pricing
■ Tips for managing DynamoDB costs
Who am I?
Alex DeBrie
AWS Data Hero
Author, The DynamoDB Book
alexdebrie1@gmail.com
@alexbdebrie
Basics of DynamoDB Pricing
Basics of DynamoDB pricing
■ The core units
■ Macro factors
■ Micro factors
The core units: RCUs + WCUs
■ Pay for reads and writes directly rather than resources
○ Traditional databases: CPU, RAM, IOPS
○ DynamoDB: RCUs and WCUs
■ Read Capacity Units (RCUs) → up to 4KB of data read
■ Write Capacity Units (WCUs) → up to 1KB of data
written
■ Storage: priced per GB-month
Billing is (mostly) independent from performance!
Concurrent queries
Response
time
Saturation
Concurrent queries
Response
time
Throttling
Concurrent queries
Response
time
Saturation
The core units: RCUs + WCUs
■ Pay for reads and writes directly rather than resources
○ Traditional databases: CPU, RAM, IOPS
○ DynamoDB: RCUs and WCUs
■ Read Capacity Units (RCUs) → up to 4KB of data read
■ Write Capacity Units (WCUs) → up to 1KB of data written
■ Storage: priced per GB-month
Billing is (mostly) independent from performance!
Basics of DynamoDB pricing
■ The core units
■ Macro factors
■ Micro factors
Basics of DynamoDB pricing
■ The core units
■ Macro factors
■ Micro factors
The macro: DynamoDB modes
■ DynamoDB bill == operations + storage.
■ Billing modes
○ Provisioned throughput → RCUs & WCUs available on a
per-second basis
○ On-demand mode → Charged per request
■ Table storage class
○ Standard → Cheaper operations but more expensive storage
○ Standard-IA → Cheaper storage but more expensive
operations
Basics of DynamoDB pricing
■ The core units
■ Macro factors
■ Micro factors
Basics of DynamoDB pricing
■ The core units
■ Macro factors
■ Micro factors
The micro: WCU + RCU multipliers
■ Item size
■ Secondary indexes
■ Transactions
■ Global tables
■ Consistent Read
■ Query vs. BatchGet
Tight feedback loop
■ Understand what's driving your costs
■ Adjust as needed
■ Tight integration between resource usage +
your costs
The micro: WCU + RCU multipliers
■ Item size
■ Secondary indexes
■ Transactions
■ Global tables
■ Consistent Read
■ Query vs. BatchGet
← Larger items require more resources
← More writes
← Coordination
← Requests to more storage nodes
← Requires routing to leader
← Replication infra + conflict resolution
Basics of DynamoDB pricing
■ The core units
■ Macro factors
■ Micro factors
Managing DynamoDB Costs
Tips for managing DynamoDB
costs
■ Mind your multipliers!
The micro: WCU + RCU multipliers
■ Item size
■ Secondary indexes
■ Transactions
■ Global tables
■ Consistent Read
■ Query vs. BatchGet
Mind your multipliers
■ Review item sizes carefully
○ Remove unused attributes
○ Compress large values (or send to S3)
○ Reduce attribute names
○ Split items if needed
Mind your multipliers
■ Review item sizes carefully
Mind your multipliers
■ Review item sizes carefully
■ Limit secondary indexes
○ Do you need an index? Writes are ~20x more
than reads.
○ Use projections to limit size of items in index
Mind your multipliers
■ Review item sizes carefully
■ Limit secondary indexes
Mind your multipliers
■ Review item sizes carefully
■ Limit secondary indexes
■ Limit transactions
Mind your multipliers
■ Review item sizes carefully
■ Limit secondary indexes
■ Limit transactions
■ Ensure you need Global Tables
Mind your multipliers
■ Review item sizes carefully
■ Limit secondary indexes
■ Limit transactions
■ Ensure you need Global Tables
■ Don't use consistent reads
Tips for managing DynamoDB
costs
■ Mind your multipliers!
Tips for managing DynamoDB
costs
■ Mind your multipliers!
■ Audit your usage
The macro: DynamoDB modes
■ DynamoDB bill == operations + storage.
■ Billing modes
○ Provisioned throughput → RCUs & WCUs available
on a per-second basis
○ On-demand mode → Charged per request
■ Table storage class
○ Standard → Cheaper operations but more
expensive storage
○ Standard-IA → Cheaper storage but more
expensive operations
Audit your usage
■ Billing mode
Choosing a billing mode
■ On-Demand costs 6.94x fully-utilized Provisioned Capacity
○ But: full utilization is hard to achieve!
○ Requires >14.4% utilization on average
■ My advice:
○ Use On-Demand until it hurts.
○ If using Provisioned, ensure you're hitting >14.4% utilization.
○ Add Auto-Scaling with caution
○ Explore Reserved Capacity
Audit your usage
■ Billing mode
Audit your usage
■ Billing mode
■ Table storage class
Choosing a table storage class
■ Indifferent whenever Operations costs are 2.4x
Storage costs
○ If >2.4x, then use Standard storage
○ If <2.4x, then use Standard-IA
■ Standard storage will (almost) always be cheaper at
first
○ Writing 1KB == 5 months of storage
○ But: this shifts over time
■ Audit this monthly!
■ Use TTL to expire data
Audit your usage
■ Billing mode
■ Table storage class
Audit your usage
■ Billing mode
■ Table storage class
■ Review secondary indexes
Audit your usage
■ Billing mode
■ Table storage class
■ Review secondary indexes
○ Does my secondary index have any reads?
Audit your usage
■ Billing mode
■ Table storage class
■ Review secondary indexes
○ Does my secondary index have any reads?
○ What is the write:read cost ratio on my
secondary index?
Audit your usage
■ Billing mode
■ Table storage class
■ Review secondary indexes
Tips for managing DynamoDB
costs
■ Mind your multipliers!
■ Audit your usage
Tips for managing DynamoDB
costs
■ Mind your multipliers!
■ Audit your usage
■ Run the numbers
DynamoDB's pricing should
change how you build
applications.
The micro: WCU + RCU multipliers
■ Item size
■ Secondary indexes
■ Transactions
■ Global tables
■ Consistent Read
■ Query vs. BatchGet
← Larger items require more resources
← More writes
← Coordination
← Requests to more storage nodes
← Requires routing to leader
← Replication infra + conflict resolution
DynamoDB's pricing should
change how you build
applications.
Keep in touch!
Alex DeBrie
AWS Data Hero
Author, The DynamoDB Book
alexdebrie1@gmail.com
@alexbdebrie

DynamoDB Cost Optimization Masterclass: Deep Dive on DynamoDB Pricing

  • 1.
    Deep Dive onDynamoDB Pricing Alex DeBrie Principal, DeBrie Advisory
  • 2.
  • 3.
  • 4.
  • 5.
    Predictable pricing ■ "ableto reason about in advance" ■ Can reason about your costs before building ■ Can see the impact of changes
  • 6.
  • 7.
    DynamoDB's pricing … ■is predictable. ■ is flexible.
  • 8.
    Flexible pricing ■ Canscale capacity up + down to match traffic ■ Can switch between modes You get all this with world-class reliability + availability
  • 9.
    DynamoDB's pricing … ■is predictable. ■ is flexible.
  • 10.
    DynamoDB's pricing … ■is predictable. ■ is flexible. ■ has a tight feedback loop.
  • 11.
    Tight feedback loop ■Understand what's driving your costs ■ Adjust as needed ■ Tight integration between resource usage + your costs
  • 12.
    DynamoDB's pricing should changehow you build applications.
  • 13.
    Outline ■ Why Ilove DynamoDB's pricing model ■ Basics of DynamoDB pricing ■ Tips for managing DynamoDB costs
  • 14.
    Who am I? AlexDeBrie AWS Data Hero Author, The DynamoDB Book alexdebrie1@gmail.com @alexbdebrie
  • 15.
  • 16.
    Basics of DynamoDBpricing ■ The core units ■ Macro factors ■ Micro factors
  • 17.
    The core units:RCUs + WCUs ■ Pay for reads and writes directly rather than resources ○ Traditional databases: CPU, RAM, IOPS ○ DynamoDB: RCUs and WCUs ■ Read Capacity Units (RCUs) → up to 4KB of data read ■ Write Capacity Units (WCUs) → up to 1KB of data written ■ Storage: priced per GB-month Billing is (mostly) independent from performance!
  • 18.
  • 19.
  • 20.
  • 21.
    The core units:RCUs + WCUs ■ Pay for reads and writes directly rather than resources ○ Traditional databases: CPU, RAM, IOPS ○ DynamoDB: RCUs and WCUs ■ Read Capacity Units (RCUs) → up to 4KB of data read ■ Write Capacity Units (WCUs) → up to 1KB of data written ■ Storage: priced per GB-month Billing is (mostly) independent from performance!
  • 22.
    Basics of DynamoDBpricing ■ The core units ■ Macro factors ■ Micro factors
  • 23.
    Basics of DynamoDBpricing ■ The core units ■ Macro factors ■ Micro factors
  • 24.
    The macro: DynamoDBmodes ■ DynamoDB bill == operations + storage. ■ Billing modes ○ Provisioned throughput → RCUs & WCUs available on a per-second basis ○ On-demand mode → Charged per request ■ Table storage class ○ Standard → Cheaper operations but more expensive storage ○ Standard-IA → Cheaper storage but more expensive operations
  • 25.
    Basics of DynamoDBpricing ■ The core units ■ Macro factors ■ Micro factors
  • 26.
    Basics of DynamoDBpricing ■ The core units ■ Macro factors ■ Micro factors
  • 27.
    The micro: WCU+ RCU multipliers ■ Item size ■ Secondary indexes ■ Transactions ■ Global tables ■ Consistent Read ■ Query vs. BatchGet
  • 28.
    Tight feedback loop ■Understand what's driving your costs ■ Adjust as needed ■ Tight integration between resource usage + your costs
  • 29.
    The micro: WCU+ RCU multipliers ■ Item size ■ Secondary indexes ■ Transactions ■ Global tables ■ Consistent Read ■ Query vs. BatchGet ← Larger items require more resources ← More writes ← Coordination ← Requests to more storage nodes ← Requires routing to leader ← Replication infra + conflict resolution
  • 30.
    Basics of DynamoDBpricing ■ The core units ■ Macro factors ■ Micro factors
  • 31.
  • 32.
    Tips for managingDynamoDB costs ■ Mind your multipliers!
  • 33.
    The micro: WCU+ RCU multipliers ■ Item size ■ Secondary indexes ■ Transactions ■ Global tables ■ Consistent Read ■ Query vs. BatchGet
  • 34.
    Mind your multipliers ■Review item sizes carefully ○ Remove unused attributes ○ Compress large values (or send to S3) ○ Reduce attribute names ○ Split items if needed
  • 35.
    Mind your multipliers ■Review item sizes carefully
  • 36.
    Mind your multipliers ■Review item sizes carefully ■ Limit secondary indexes ○ Do you need an index? Writes are ~20x more than reads. ○ Use projections to limit size of items in index
  • 37.
    Mind your multipliers ■Review item sizes carefully ■ Limit secondary indexes
  • 38.
    Mind your multipliers ■Review item sizes carefully ■ Limit secondary indexes ■ Limit transactions
  • 39.
    Mind your multipliers ■Review item sizes carefully ■ Limit secondary indexes ■ Limit transactions ■ Ensure you need Global Tables
  • 40.
    Mind your multipliers ■Review item sizes carefully ■ Limit secondary indexes ■ Limit transactions ■ Ensure you need Global Tables ■ Don't use consistent reads
  • 41.
    Tips for managingDynamoDB costs ■ Mind your multipliers!
  • 42.
    Tips for managingDynamoDB costs ■ Mind your multipliers! ■ Audit your usage
  • 43.
    The macro: DynamoDBmodes ■ DynamoDB bill == operations + storage. ■ Billing modes ○ Provisioned throughput → RCUs & WCUs available on a per-second basis ○ On-demand mode → Charged per request ■ Table storage class ○ Standard → Cheaper operations but more expensive storage ○ Standard-IA → Cheaper storage but more expensive operations
  • 44.
  • 45.
    Choosing a billingmode ■ On-Demand costs 6.94x fully-utilized Provisioned Capacity ○ But: full utilization is hard to achieve! ○ Requires >14.4% utilization on average ■ My advice: ○ Use On-Demand until it hurts. ○ If using Provisioned, ensure you're hitting >14.4% utilization. ○ Add Auto-Scaling with caution ○ Explore Reserved Capacity
  • 46.
  • 47.
    Audit your usage ■Billing mode ■ Table storage class
  • 48.
    Choosing a tablestorage class ■ Indifferent whenever Operations costs are 2.4x Storage costs ○ If >2.4x, then use Standard storage ○ If <2.4x, then use Standard-IA ■ Standard storage will (almost) always be cheaper at first ○ Writing 1KB == 5 months of storage ○ But: this shifts over time ■ Audit this monthly! ■ Use TTL to expire data
  • 49.
    Audit your usage ■Billing mode ■ Table storage class
  • 50.
    Audit your usage ■Billing mode ■ Table storage class ■ Review secondary indexes
  • 51.
    Audit your usage ■Billing mode ■ Table storage class ■ Review secondary indexes ○ Does my secondary index have any reads?
  • 52.
    Audit your usage ■Billing mode ■ Table storage class ■ Review secondary indexes ○ Does my secondary index have any reads? ○ What is the write:read cost ratio on my secondary index?
  • 53.
    Audit your usage ■Billing mode ■ Table storage class ■ Review secondary indexes
  • 54.
    Tips for managingDynamoDB costs ■ Mind your multipliers! ■ Audit your usage
  • 55.
    Tips for managingDynamoDB costs ■ Mind your multipliers! ■ Audit your usage ■ Run the numbers
  • 56.
    DynamoDB's pricing should changehow you build applications.
  • 57.
    The micro: WCU+ RCU multipliers ■ Item size ■ Secondary indexes ■ Transactions ■ Global tables ■ Consistent Read ■ Query vs. BatchGet ← Larger items require more resources ← More writes ← Coordination ← Requests to more storage nodes ← Requires routing to leader ← Replication infra + conflict resolution
  • 58.
    DynamoDB's pricing should changehow you build applications.
  • 59.
    Keep in touch! AlexDeBrie AWS Data Hero Author, The DynamoDB Book alexdebrie1@gmail.com @alexbdebrie