The CLI and especially GUI submitter were very slow to make API calls. The root cause was poorly matched TTLs that resulted in credentials being refreshed from DCM before every API call.
DCM vends credentials which are valid for 15 minutes, and by default boto's credential handling refreshes credential when they're within 15 minutes of expiring. As a result, credential were always marked as stale and constantly refreshed. Refreshing DCM creds takes ~5 seconds, so every API call takes at least that long to complete.
What was the solution? (How)
Configure the refresh mechanism to only refresh creds when they're within 2 minutes of expiring. Also strip out a custom caching mechanism we had and use the much simpler @lru_cache decorator instead.
What is the impact of this change?
DCM credentials and boto sessions are effectively reused resulting in a much more responsive GUI submitter (among other DCM functionality).
How was this change tested?
Have you run hatch run test ?
Yes
Have you run hatch run integ:test ? See DEVELOPMENT.md on "Run integration tests"
Yes
Manual tests:
I opened the GUI submitter, waited 15 minutes for the DCM creds to expire, then opened the settings window to trigger more API calls. The client refreshed credentials as expected.
I verified these changes work with non-DCM credentials.
Was this change documented?
Not needed
Is this a breaking change?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
What was the problem/requirement? (What/Why)
The CLI and especially GUI submitter were very slow to make API calls. The root cause was poorly matched TTLs that resulted in credentials being refreshed from DCM before every API call.
DCM vends credentials which are valid for 15 minutes, and by default boto's credential handling refreshes credential when they're within 15 minutes of expiring. As a result, credential were always marked as stale and constantly refreshed. Refreshing DCM creds takes ~5 seconds, so every API call takes at least that long to complete.
What was the solution? (How)
Configure the refresh mechanism to only refresh creds when they're within 2 minutes of expiring. Also strip out a custom caching mechanism we had and use the much simpler
@lru_cache
decorator instead.What is the impact of this change?
DCM credentials and boto sessions are effectively reused resulting in a much more responsive GUI submitter (among other DCM functionality).
How was this change tested?
Have you run
hatch run test
? YesHave you run
hatch run integ:test
? SeeDEVELOPMENT.md
on "Run integration tests" YesManual tests:
Was this change documented?
Not needed
Is this a breaking change?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.