mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
perf(apigateway): skip the key copy for a host that is no custom domain (#7727)
Every request of every service looked its Host up among the custom domains. The lookup copied all stored domain keys and cut a substring per key, and almost no host is a custom domain. 100 domains added about 19 KB to each request. A walk over the stored keys now answers a miss first. It copies nothing. A hit still takes the old path, so the owner, region and conflict rules stay the same.
This commit is contained in:
1 parent
6974d8c096
commit
9a88ebf830
2 files changed
+25
-6
No files matched your search
@@ -3284,8 +3284,13 @@ public class ApiGatewayService implements ResourceProvider {
|
||||
* @return the domain's routing scope if found, or null if no domain matches
|
||||
*/
|
||||
public CustomDomainRoute findDomainByName(String domainName) {
|
||||
String keySuffix = "::" + domainName;
|
||||
// Every request of every service gets here, and scanAllAccountEntries copies every key.
|
||||
if (domainStore.scanRaw(rawKey -> rawKey.endsWith(keySuffix)).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<AccountAwareStorageBackend.AccountEntry<CustomDomain>> matches =
|
||||
domainStore.scanAllAccountEntries(key -> key.endsWith("::" + domainName));
|
||||
domainStore.scanAllAccountEntries(key -> key.endsWith(keySuffix));
|
||||
if (matches.size() > 1) {
|
||||
throw new AwsException("ConflictException",
|
||||
"Custom domain '" + domainName + "' is ambiguous across accounts or regions", 409);
|
||||
|
||||
Reference in new issue
Block a user