DynamoDB Lens - Analyze your DynamoDB environment
Project description
DynamoDB Lens
A set of tools to help understand DynamoDB table performance capabilities and potential cost optimization opportunities.
Installation and usage
Installation
python3 -m pip install dynamodb-lens
CLI usage
usage: dynamodb_lens.cli [-h] --table_name TABLE_NAME [--save_output] [--verbose]
optional arguments:
-h, --help show this help message and exit
--table_name TABLE_NAME
--save_output save the json formatted output to a file
--verbose Print the full output, otherwise a summary will be printed
Example:
python3 -m dynamodb_lens.cli --table_name sentences1
Table Analyzer
This library analyzes a table's current state, configuration and usage in order to:
TableAnalyzer class usage
The class can be imported and called directly if the dynamodb_lens.cli
doesn't fit the use case
The only required parameter is table_name, and optionally verbose=True|False
plus already instantiated boto3 clients can be passed in.
from dynamodb_lens.analyzer import TableAnalyzer
table = TableAnalyzer(
table_name='foo',
verbose=False
)
table.save_output()
1. Estimate performance capabilities
A DynamoDB Table's current partition count as well as table settings will determine its performance capabilities.
Partition count is not exposed directly, but we can infer the number of partitions in several ways:
- Count the number of Open DynamoDB Stream shards, it is a 1:1 mapping of Open shards to Partitions
- Check cloudwatch max Provisioned settings over the last 3 months
- Check cloudwatch max WCU/RCU utilization over the last 1 month
- Check current WCU/RCU settings on the table if Provisioned mode is currently configured
- Check the current storage utilization of the table
If Streams is not enabled, this program will estimate current number of partitions based on the maximum WCU/RCU values
calculated from the data gathered in #2-5 above.
DynamoDB tables never give back partitions once they've been allocated.
This is what is meant by "previous peak" in the documentation.
This program is more accurate if DynamoDB Streams is enabled for the table.
Enabling streams is outside the scope of this program, it can be done via:
aws dynamodb update-table --table-name <value> --stream-specification StreamEnabled=true,StreamViewType=KEYS_ONLY
and disabled with:
aws dynamodb update-table --table-name <value> --stream-specification StreamEnabled=false
Please review the documentation and understand the implications of running these commands before executing them.
2. TODO: Capacity recommendations
NOTE: This is a future state item planned, but not currently implemented.
On-Demand capacity mode for DynamoDB allows unpredictable workloads to avoid throttling (ish), but this stability comes at a cost.
It is significantly more expensive than Provisioned in most cases.
There are many scenarios where On-Demand is either not necessary or a provisioned table will flat out be cheaper.
The recommendation should inform the user of potential cost savings opportunity.
We can present various configurations and the associated cost savings estimates and risk levels of switching to provisioned.
For example, switching to Provisioned Throughput mode with:
MIN/MAX Autoscaling WCU/RCU settings
P33 MIN/P100 MAX Autoscaling WCU/RCU settings
P50 MIN/P100 MAX Autoscaling WCU/RCU settings
P90 MIN/P100 MAX Autoscaling WCU/RCU settings
P100 static WCU/RCU settings
Will provide varying degrees of cost savings with directly linked levels of risk.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for dynamodb_lens-23.10.dev3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a4bbe98d461050db0a143ab120ff2ba26ef892f8b47772569d09405bd8c324c |
|
MD5 | 6feb52c26e61a04d5588ec4c63d2aa15 |
|
BLAKE2b-256 | 05ecd8710f8d14956c3da35a2422cd8f5f4245420a2f6e9646dd1d2f83265eb3 |