mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
perf(cloudfront): skip the host lookup when no distribution exists (#7467)
* perf(cloudfront): skip the host lookup when no distribution exists CloudFrontDistributionFilter scanned the distribution store on every request of every service. CloudFrontService.hasDistributions() lets the filter return at once while the store is empty, which is what findByHost answered then anyway. * perf(cloudfront): keep the distribution check free once one exists AccountAwareStorageBackend.isEmpty() copies every key once the store holds an entry, so a distribution in any account made each request pay that copy before the same host scan as before. The filter only needs to know whether any distribution exists, which the backing store answers without a copy.
This commit is contained in:
1 parent
62bfd5e5ce
commit
d7a3461fbc
4 files changed
+33
-2
No files matched your search
+16
@@ -52,6 +52,22 @@ class AccountAwareStorageBackendTest {
|
||||
assertTrue(second.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void isEmptyInAllAccountsSeesEveryAccount() {
|
||||
InMemoryStorage<String, String> raw = new InMemoryStorage<>();
|
||||
AccountAwareStorageBackend<String> first =
|
||||
new AccountAwareStorageBackend<>(raw, null, "111111111111");
|
||||
AccountAwareStorageBackend<String> second =
|
||||
new AccountAwareStorageBackend<>(raw, null, "222222222222");
|
||||
|
||||
assertTrue(second.isEmptyInAllAccounts());
|
||||
|
||||
first.put("resource", "value");
|
||||
|
||||
assertTrue(second.isEmpty());
|
||||
assertFalse(second.isEmptyInAllAccounts());
|
||||
}
|
||||
|
||||
@Test
|
||||
void putAllPrefixesEveryEntryWithTheRequestScope() {
|
||||
InMemoryStorage<String, String> raw = new InMemoryStorage<>();
|
||||
|
||||
Reference in new issue
Block a user