-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change ec2nvme-nsid to use Bash built-ins #32
Change ec2nvme-nsid to use Bash built-ins #32
Conversation
This simple change cuts the runtime by more than half and CPU by almost a third. It also makes the script more reliable when resources are constrained (the sort of situation where you might suddenly attach more EBS NVMe volumes) and helps improve the performance of the early boot process (initrd/initramfs), should you make these scripts part of that. Performance before: $ time bash -c 'for i in $(seq 1 10000); do bash ./ec2nvme-nsid nvme0n1234234p2 > /dev/null; done' bash -c 38.00s user 90.67s system 92% cpu 2:18.43 total Performance after: $ time bash -c 'for i in $(seq 1 10000); do bash ./ec2nvme-nsid nvme0n1234234p2 > /dev/null; done' bash -c 12.61s user 27.56s system 66% cpu 1:00.26 total Signed-off-by: Keith Gable <gablk@amazon.com>
I've got a few other changes that I'll submit PRs for (I've been maintaining copies of these scripts for years - long before we became part of Amazon :)), and will submit them shortly. The .spec file will have conflicts because of that, so let me know the least friction way to get the changes merged. Some projects prefer small PRs with atomic changes, where others prefer a bigger PR - let me know which is easiest for y'all. Also feel free to Slack me on-corp. |
It actually appears that the only change I can really safely land was #33 - the other things I have ready are:
|
This consolidates the changes from amazonlinux#32 and amazonlinux#33 into one nice PR --------- Signed-off-by: Keith Gable <gablk@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Going to leave this for @vigh-m to handle the rest of the merge activities, as he'll be taking over as maintainer.
This simple change cuts the runtime by more than half and CPU by almost a third. It also makes the script more reliable when resources are constrained (the sort of situation where you might suddenly attach more EBS NVMe volumes) and helps improve the performance of the early boot process (initrd/initramfs), should you make these scripts part of that.
Performance before:
Performance after: