Files
floci/src
TATSUNO “Taz” Yasuhiro df3ce4a198 perf(iam): find sessions across accounts without scanning every session (#3881)
A request signed with temporary credentials resolves its account before the
request context exists. IamService found the session with scanAllAccountsAsMap,
which copied every session of every account into a map on each such request,
even with IAM enforcement off. Expired sessions leave the store only when they
are looked up, so this cost grew over time.

The session lookup now uses findAnyAccount. AccountAwareStorageBackend keeps
the set of accounts that own keys, so findAnyAccountEntry does one get per
account instead of a scan. The first cross-account lookup builds the set with
one scan, and later writes add their account. A store that never looks across
accounts pays one volatile read per write. Accounts are never removed, so a
stale one only costs a missed get.

findAnyAccountEntry now reads the caller's partition from the delegate and
calls get only when un-prefixed legacy data exists. It no longer waits on the
store monitor that the legacy migrations hold.

The S3, EC2 and Route53 callers of findAnyAccountEntry use the same path.
2026-09-18 17:38:29 -04:00
..