Closed varunm17 closed 10 months ago
Hi @varunm17,
Thanks for the report, with the current information however it'll be hard to figure out where the performance problem appears, so I'll request help from you to figure out the source of the problem if you can.
Could you share your configurations please? I've taken a quick look at the logs from one of your builds (AL2), looks like the script is slower for some reason (~4 minutes vs. 7 minutes), the plugin's version is the same, and the OS image looks similar as well from a quick look, so it could be a SSH-related problem potentially, but it's hard to say with just that information.
The script outputs something else in the 1.1.4 run however:
main.amazon-ebs.xyz_ami: skipping: package-cleanup -q --leaves | xargs -l1 yum -y remove
main.amazon-ebs.xyz_ami: due to package dep locale bug
Is there an error that causes this? I don't have access to the script that you're running, so it's hard to say, but if it exits prematurely, that might be why 1.14 is faster, no clue why that'd be though since the rest of the environment looks similar.
Is the host the same machine in both tests?
Also, may I ask your help in determining which version introduces the slowdown? Could you bisect all the versions from 1.1.4 -> 1.2.9, so we have a better idea where to look?
Thanks.
hi @lbajolet-hashicorp,
Thanks you for your response. You can ignore the script output, from this issue we are specifically observing the slowness during execution of ansible playbooks. We do not see any errors just the execution time has increased as reported. You are correct we have everything in common in the environment except the packer amazon plugin versions.
The host is not the same machine. Each build spins up a fresh instance. But we are able to replicate this issue at our will.
The packer amazon plugin version where the execution time started to increase is 1.1.5
.
Hope this helps.
Thanks for the follow-up.
Looking at the diff between 1.1.4 and 1.1.5, this should not change much as we only introduced a new option (enable_unlimited_credits
) with this version (refer to PR #273 for context). We also started building with go 1.18 instead of 1.17, but this should not impact performance too.
By any chance, did you specify an instance type to run the builds on? Are you using spot instances? I'm wondering if the instance type picked changed between those two versions, which may explain why scripts are suddenly slower to execute on the instance. Could you check that on your side and report to us? We'll see if that's something we can explain/fix/workaround.
1.1.4
to 1.1.5
and the issue was reproduced.ansible.cfg
[defaults]
bin_ansible_callbacks = True
callbacks_enabled = timer, profile_roles, profile_tasks
after that we tried to test with all other version available untill 1.2.9
, but none of the version was anywhere close to execution time of 1.1.4
hence we reverted back to using 1.1.4
and everything was back to normal.
Our packer config is like below(trimmed down version) - https://gist.github.com/varunm17/8393f3609a4361aaee687d4ead429455
@varunm17 one thing I don't know from the template you shared is the instance type, you're not using spot instances I'd think (unless I missed the option) so that might be indeed due to the PR we merged, which always sets the credit specification on T2/T3/T3a/T4g instances, and if unspecified in the config, this will be false, i.e. standard. Prior to this version, if unset on T3/T3a/T4g instances, the default credit spec would be unlimited by default, which could be why your builds slowed down.
Could you try to enable unlimited credits on your configs? Adding enable_unlimited_credits = true
to the source's configuration should do the trick.
thanks @lbajolet-hashicorp for your inputs, indeed we were using t3 instance, hence after Adding enable_unlimited_credits = true
the execution time is back to normal, really appreciate your analysis and solution
Overview of the Issue
We are customising many different OS as per our requirements. We were using the version
1.1.4
and we plan to use the latest version of the plugin (1.2.9
), however after updating the plugin version we have observed that the build time has almost doubled in case of linux AMI's and for windows the build time has increased by almost 4 times.Reproduction Steps
1.1.4
and any higher version and you will observe the build times.Plugin and Packer version
Packer version:
1.10.0 [go1.20.11 linux amd64]
Ansibe packer plugin version :1.1.1
Operating system and Environment details
Operating System:
Log Fragments and crash.log files
For sharing the logs we have executed only few ansible playbooks, hence the execution time is on the lower end but still we can observe the execution time after upgrading the plugin has increased significantly