https://github.com/awslabs/kinesis-hot-shard-advisor
The Amazon Kinesis Hot Shard Advisor is a CLI tool that simplifies identifying whether you have hot key or hot shard issues on your Kinesis data streams. The tool can also identify whether you are hitting the shard level throughput limit per-second basis.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.8%) to scientific vocabulary
Keywords
Repository
The Amazon Kinesis Hot Shard Advisor is a CLI tool that simplifies identifying whether you have hot key or hot shard issues on your Kinesis data streams. The tool can also identify whether you are hitting the shard level throughput limit per-second basis.
Basic Info
Statistics
- Stars: 26
- Watchers: 2
- Forks: 1
- Open Issues: 4
- Releases: 12
Topics
Metadata Files
readme.md
Amazon Kinesis Hot Shard Advisor (khs)
Easily identify hot shard and hot key on your Kinesis data streams.
About
The Amazon Kinesis Hot Shard Advisor is a CLI tool that simplifies identifying whether you have hot key or hot shard issues on your Kinesis data streams. The tool can also identify whether you are hitting the shard level throughput limit per-second basis.
Why KHS?
An Amazon Kinesis Data Stream consists of one or more shards. Records with the same partition key is always written to the same shard. Each shard has a maximum throughput it can support. When a producer application attempts to put records at a higher rate than the maximum throughput available, they receive WriteThroughputExceeded error. This is commonly known as the hot shard problem.
When you experience a hot shard problem, you will notice an increase of WriteProvisionedThroughputExceeded metric in CloudWatch. However, for bursty workloads you may not notice the corresponding data in IncomingRecords and IncomingBytes metrics due to per minute aggregation. You can get the visibility to bursty writes with khs because it reads the records from your stream and aggregate the record size per second based on ApproximateArrivalTimestamp.
Typically when there's a hot shard problem, you can increase the number of shards in the stream to increase available throughput (or change the capacity mode of your stream to on-demand). Increasing the number of shards does not solve the problem if it's caused by the producer using a key (or set of keys) more frequently than others. This is known as the hot key problem and requires an adjutment to parition key scheme to solve it. khs helps you identify hot key issues by showing the frequency of keys that are written to your stream within a given time period.
Prerequisite
In order to perform analysis on your Kinesis Data Stream, khs must be executed under the context of an IAM entity with access to the following actions.
kinesis:ListShards
kinesis:DescribeStreamSummary
kinesis:RegisterStreamConsumer
kinesis:DeregisterStreamConsumer
kinesis:SubscribeToShard
kinesis:DescribeStreamConsumer
** khs will use the AWSCli configuration to access Kinesis data streams on a particular AWS region. If the default region is not configured in the current session, you must also specify the region of the Kinesis Data Stream via AWSDEFAULTREGION environment variable.
Getting Started
- download the compatible binary from releases and rename the file name to khs
- Use the command line and navigate to the directory where you downloaded the binary earlier
- run the below command
khs -stream=[YOUR STREAM NAME]] -from="yyyy-mm-dd hh:mm" -to="yyyy-mm-dd hh:mm" Example: khs -stream=lab3 -from="2022-02-24 10:07" -to="2022-02-24 10:09" Note: The date range should be within the retention period of your Kinesis data streams.## Output sampleListing shards for stream lab3...OK! 10 / 10 [====================================================] 100.00% 2m52s output is written to out.html
View the Report
Once you see the output as above, open the file pointed by out option (by default this is set to out.html file from your current directory) with your default browser to view the report.
Usage
Usage of khs:
-cms
Use count-min-sketch (Optional) algorithm for counting key distribution (Optional). Default is false. Use this method to avoid OOM condition when analysing busy streams with high cardinality.
-from string
Start time in yyyy-mm-dd hh:mm format (Optional). Default value is current time - 5 minutes.
-limit int
Number of keys to output in key distribution graph (Optional). (default 10)
-out string
Path to output file (Optional). Default is out.html. (default "out.html")
-shard-ids string
Comma separated list of shard ids to analyse.
-stream string
Stream name
-to string
End time in yyyy-mm-dd hh:mm format (Optional). Default value is current time.
-top int
Number of shards to emit to the report(Optional). Use 0 to emit all shards. Emitting all shards can result in a large file that may take a lot of system resources to view in the browser. (default 10)
Sample Report

Contributing to the project
If you are interested in contributing to this project, here are the steps you can follow.
Owner
- Name: Amazon Web Services - Labs
- Login: awslabs
- Kind: organization
- Location: Seattle, WA
- Website: http://amazon.com/aws/
- Repositories: 914
- Profile: https://github.com/awslabs
AWS Labs
GitHub Events
Total
- Create event: 2
- Release event: 1
- Issues event: 2
- Watch event: 2
- Issue comment event: 3
- Push event: 1
- Pull request event: 5
- Fork event: 2
Last Year
- Create event: 2
- Release event: 1
- Issues event: 2
- Watch event: 2
- Issue comment event: 3
- Push event: 1
- Pull request event: 5
- Fork event: 2
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 111
- Total Committers: 3
- Avg Commits per committer: 37.0
- Development Distribution Score (DDS): 0.225
Top Committers
| Name | Commits | |
|---|---|---|
| Buddhike de Silva | b****s@a****m | 86 |
| Masudur Rahaman Sayem | m****s@a****m | 20 |
| Masudur Rahaman Sayem | 3****r@u****m | 5 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 14
- Total pull requests: 25
- Average time to close issues: 11 days
- Average time to close pull requests: 2 days
- Total issue authors: 1
- Total pull request authors: 3
- Average comments per issue: 0.07
- Average comments per pull request: 0.24
- Merged pull requests: 22
- Bot issues: 0
- Bot pull requests: 3
Past Year
- Issues: 1
- Pull requests: 3
- Average time to close issues: 2 months
- Average time to close pull requests: 4 days
- Issue authors: 1
- Pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
- buddhike (14)
- benmali (1)
Pull Request Authors
- buddhike (21)
- dependabot[bot] (3)
- TessaIO (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
proxy.golang.org: github.com/awslabs/kinesis-hot-shard-advisor
- Homepage: https://github.com/awslabs/kinesis-hot-shard-advisor
- Documentation: https://pkg.go.dev/github.com/awslabs/kinesis-hot-shard-advisor#section-documentation
- License: MIT-0
-
Latest release: v0.0.1-alpha
published about 4 years ago
Rankings
Dependencies
- github.com/aws/aws-sdk-go-v2 v1.16.3
- github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.2.0
- github.com/aws/aws-sdk-go-v2/config v1.13.0
- github.com/aws/aws-sdk-go-v2/credentials v1.8.0
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.10.0
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.4
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.2.0
- github.com/aws/aws-sdk-go-v2/internal/ini v1.3.4
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.7.0
- github.com/aws/aws-sdk-go-v2/service/kinesis v1.13.0
- github.com/aws/aws-sdk-go-v2/service/sso v1.9.0
- github.com/aws/aws-sdk-go-v2/service/sts v1.14.0
- github.com/aws/smithy-go v1.11.2
- github.com/cheggaaa/pb v1.0.29
- github.com/davecgh/go-spew v1.1.1
- github.com/fatih/color v1.13.0
- github.com/google/uuid v1.3.0
- github.com/jmespath/go-jmespath v0.4.0
- github.com/mattn/go-colorable v0.1.9
- github.com/mattn/go-isatty v0.0.14
- github.com/mattn/go-runewidth v0.0.13
- github.com/pmezard/go-difflib v1.0.0
- github.com/rivo/uniseg v0.2.0
- github.com/stretchr/testify v1.7.1
- golang.org/x/exp v0.0.0-20220428152302-39d4317da171
- golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
- gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
- github.com/aws/aws-sdk-go-v2 v1.13.0
- github.com/aws/aws-sdk-go-v2 v1.16.3
- github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.2.0
- github.com/aws/aws-sdk-go-v2/config v1.13.0
- github.com/aws/aws-sdk-go-v2/credentials v1.8.0
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.10.0
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.4
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.2.0
- github.com/aws/aws-sdk-go-v2/internal/ini v1.3.4
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.7.0
- github.com/aws/aws-sdk-go-v2/service/kinesis v1.13.0
- github.com/aws/aws-sdk-go-v2/service/sso v1.9.0
- github.com/aws/aws-sdk-go-v2/service/sts v1.14.0
- github.com/aws/smithy-go v1.10.0
- github.com/aws/smithy-go v1.11.2
- github.com/cheggaaa/pb v1.0.29
- github.com/davecgh/go-spew v1.1.0
- github.com/davecgh/go-spew v1.1.1
- github.com/fatih/color v1.9.0
- github.com/fatih/color v1.13.0
- github.com/google/go-cmp v0.5.4
- github.com/google/go-cmp v0.5.6
- github.com/google/go-cmp v0.5.7
- github.com/google/uuid v1.3.0
- github.com/jmespath/go-jmespath v0.4.0
- github.com/jmespath/go-jmespath/internal/testify v1.5.1
- github.com/mattn/go-colorable v0.1.4
- github.com/mattn/go-colorable v0.1.9
- github.com/mattn/go-isatty v0.0.8
- github.com/mattn/go-isatty v0.0.11
- github.com/mattn/go-isatty v0.0.12
- github.com/mattn/go-isatty v0.0.14
- github.com/mattn/go-runewidth v0.0.4
- github.com/mattn/go-runewidth v0.0.13
- github.com/pmezard/go-difflib v1.0.0
- github.com/rivo/uniseg v0.2.0
- github.com/stretchr/objx v0.1.0
- github.com/stretchr/testify v1.7.1
- golang.org/x/exp v0.0.0-20220428152302-39d4317da171
- golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
- golang.org/x/sys v0.0.0-20191026070338-33540a1f6037
- golang.org/x/sys v0.0.0-20200116001909-b77594299b42
- golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae
- golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
- golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
- golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
- gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
- gopkg.in/yaml.v2 v2.2.8
- gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
- actions/checkout v2 composite
- actions/setup-go v2 composite
- skx/github-action-publish-binaries master composite