Skip to content

Conversation

MatthewJohn
Copy link
Contributor

@MatthewJohn MatthewJohn commented Oct 4, 2025

Rollback Plan

A new attribute has been added, but believe this can just be reverted.

Changes to Security Controls

No

Description

The original implementation called d.Get("task") for each task's source_fields attribute. As a result, for each task, d.Get("task") is called - which turns out to be expensive. For example for ~350 tasks, this seemed to take about 15 minutes. Profiling for this original behavoir can be seen in the PR.

This change introduces a new single_task_flag attribute, which is computed once during the read operation and this is used to determine if a single task is present (which is what the original result of d.Get("task") was used for. From local testing of the use-case, this completely fixes the slow-down

Relations

Closes #0000

References

Output from Acceptance Testing

% make testacc TESTS=TestAccXXX PKG=ec2

...

I don't have access to an AWS account, so I'm not fully sure how I can run these tests :/
I'm also not sure if I should be adding test cases?

The original implementation called d.Get("task") for each task's source_fields attribute.
As a result, for each task, d.Get("task") is called - which turns out to be expensive.
For example for ~350 tasks, this seemed to take about 15 minutes.
Profiling for this original behavoir can be seen in the PR.

This change introduces a new single_task_flag attribute, which is computed once during the read operation and this is used to determine if a single task is present (which is what the original result of d.Get("task") was used for.
From local testing of the use-case, this completely fixes the slow-down
Copy link
Contributor

github-actions bot commented Oct 4, 2025

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@MatthewJohn
Copy link
Contributor Author

Flame graph from original:
go_profiling_flamegraph

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/appflow Issues and PRs that pertain to the appflow service. size/S Managed by automation to categorize the size of a PR. labels Oct 4, 2025
@MatthewJohn MatthewJohn marked this pull request as ready for review October 6, 2025 06:53
@MatthewJohn MatthewJohn requested a review from a team as a code owner October 6, 2025 06:53
Copy link
Contributor

github-actions bot commented Oct 6, 2025

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions bot added the tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. label Oct 7, 2025
@MatthewJohn MatthewJohn force-pushed the fix-appflow-flow-slow-task branch from dbad771 to a1efbd6 Compare October 7, 2025 07:13
@MatthewJohn MatthewJohn force-pushed the fix-appflow-flow-slow-task branch from a1efbd6 to 47da76d Compare October 7, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Waiting for first response or review from a maintainer. service/appflow Issues and PRs that pertain to the appflow service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant