Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws/credentials: Update Credentials cache to use RWMutex (#1973)
Updates the Credentials type's cache of the CredentialsValue to be synchronized with a RWMutex instead of Mutex. This reduces the overhead applications will encounter when many concurrent API requests are being made. Benchmarks of Credential.Get improvements. This will be the normal case until credentials expire. Each benchmark increases the number of concurrent gets. benchmark old ns/op new ns/op delta BenchmarkCredentials_Get/1-4 64.0 33.5 -47.66% BenchmarkCredentials_Get/10-4 1162 545 -53.10% BenchmarkCredentials_Get/100-4 16016 5424 -66.13% BenchmarkCredentials_Get/500-4 62655 27175 -56.63% BenchmarkCredentials_Get/1000-4 137267 54247 -60.48% BenchmarkCredentials_Get/10000-4 9040107 541044 -94.02% Benchmark of Credentials.Get with the credentials periodically expiring. The {rate}-{concurrent} benchmarks will expire the credentials every {rate} attempts to get credentials, with {concurrent} credential getters. benchmark old ns/op new ns/op delta BenchmarkCredentials_Get_Expire/10000-1-4 214 176 -17.76% BenchmarkCredentials_Get_Expire/10000-10-4 1515 666 -56.04% BenchmarkCredentials_Get_Expire/10000-100-4 15988 5600 -64.97% BenchmarkCredentials_Get_Expire/10000-500-4 74389 28826 -61.25% BenchmarkCredentials_Get_Expire/10000-1000-4 172104 57977 -66.31% BenchmarkCredentials_Get_Expire/10000-10000-4 7772087 594408 -92.35% BenchmarkCredentials_Get_Expire/1000-1-4 1421 1172 -17.52% BenchmarkCredentials_Get_Expire/1000-10-4 2835 1867 -34.14% BenchmarkCredentials_Get_Expire/1000-100-4 17592 6986 -60.29% BenchmarkCredentials_Get_Expire/1000-500-4 53066 30900 -41.77% BenchmarkCredentials_Get_Expire/1000-1000-4 130093 60024 -53.86% BenchmarkCredentials_Get_Expire/1000-10000-4 6175162 588944 -90.46% BenchmarkCredentials_Get_Expire/100-1-4 13443 13497 +0.40% BenchmarkCredentials_Get_Expire/100-10-4 14762 13974 -5.34% BenchmarkCredentials_Get_Expire/100-100-4 26726 19201 -28.16% BenchmarkCredentials_Get_Expire/100-500-4 64969 44532 -31.46% BenchmarkCredentials_Get_Expire/100-1000-4 142072 76738 -45.99% BenchmarkCredentials_Get_Expire/100-10000-4 8396878 522469 -93.78%
- Loading branch information