Read-Write Capacity Mode

Amazon DynamoDB has two read/write capacity modes for processing reads and writes on your tables

  • On-demand
  • Provisioned (default, free-tier eligible)

On-demand

is a flexible billing option capable of serving thousands of requests per second without capacity planning

  • offers pay-per-request pricing for read and write requests so that you pay only for what you use.
  • DynamoDB instantly accommodates your workloads as they ramp up or down to any previously reached traffic level.
  • On-demand capacity mode instantly accommodates up to double the previous peak traffic on a table. However, throttling can occur if you exceed double your previous peak within 30 minutes.
  • On-demand mode is a good option if any of the following are true
    • You create new tables with unknown workloads.
    • You have unpredictable application traffic.
    • You prefer the ease of paying for only what you use.

DynamoDB charges you for the reads and writes that your application performs on your tables in terms of read request units and write request units.

  • One read request unit represents one strongly consistent read request, or two eventually consistent read requests, for an item up to 4 KB in size. Two read request units represent one transactional read for items up to 4 KB.
  • One write request unit represents one write for an item up to 1 KB in size

Initial Throughput for On-Demand Capacity Mode

  • Newly created table with on-demand capacity mode: The previous peak is 2,000 write request units or 6,000 read request units.
  • Existing table switched to on-demand capacity mode: The previous peak is half the maximum write capacity units and read capacity units provisioned since the table was created, or the settings for a newly created table with on-demand capacity mode, whichever is higher.

Provisioned (default, free-tier eligible)

you specify the number of reads and writes per second that you require for your application. You can use auto scaling to adjust your table’s provisioned capacity automatically in response to traffic changes.

  • Provisioned mode is a good option if any of the following are true:
    • You have predictable application traffic.
    • You run applications whose traffic is consistent or ramps gradually.
    • You can forecast capacity requirements to control costs.

specify throughput capacity in terms of read capacity units (RCUs) and write capacity units (WCUs):

  • One read capacity unit represents one strongly consistent read per second, or two eventually consistent reads per second, for an item up to 4 KB in size. Transactional read requests require two read capacity units to perform one read per second for items up to 4 KB.
  • One write capacity unit represents one write per second for an item up to 1 KB in size. Transactional write requests require 2 write capacity units to perform one write per second for items up to 1 KB.

Provisioned throughput is the maximum amount of capacity that an application can consume from a table or index. If your application exceeds your provisioned throughput capacity on a table or index, it is subject to request throttling.

you can purchase reserved capacity in advance, where you pay a one-time upfront fee and commit to a minimum provisioned usage level over a period of time.

// When you switch a table from provisioned capacity mode to on-demand capacity mode, DynamoDB makes several changes to the structure of your table and partitions. This process can take several minutes. During the switching period, your table delivers throughput that is consistent with the previously provisioned write capacity unit and read capacity unit amounts. When switching from on-demand capacity mode back to provisioned capacity mode, your table delivers throughput consistent with the previous peak reached when the table was set to on-demand capacity mode.
// Throttling prevents your application from consuming too many capacity units. When a request is throttled, it fails with an HTTP 400 code (Bad Request) and a ProvisionedThroughputExceededException. The AWS SDKs have built-in support for retrying throttled requests
// With DynamoDB auto scaling, a table or a global secondary index can increase its provisioned read and write capacity to handle sudden increases in traffic, without request throttling. When the workload decreases, DynamoDB auto scaling can decrease the throughput so that you don't pay for unused provisioned capacity.
// If you use the AWS Management Console to create a table or a global secondary index, DynamoDB auto scaling is enabled by default.