aws-deadline / deadline-cloud

Multi-purpose library and command line tool that implements functionality to support applications using AWS Deadline Cloud.
Apache License 2.0
25 stars 28 forks source link

fix: credential caching improvements #431

Closed crowecawcaw closed 1 month ago

crowecawcaw commented 1 month ago

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?

Manual tests:

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.

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud