Part of #63.
Problem
GenericAwsScanner::executeApiCall() (app/app/Services/Scanners/GenericAwsScanner.php:82) constructs a new Sdk() and a new client for every single API call. A region job doing 200 calls builds 200 clients.
The SDK memoizes API models statically so this is not catastrophic, but it is pure waste.
Change
Memoize the client per (service, region) for the lifetime of the scanner instance.
Natural to do alongside PERF-5, which touches the same construction path.
Priority: P2
Part of #63.
Problem
GenericAwsScanner::executeApiCall()(app/app/Services/Scanners/GenericAwsScanner.php:82) constructs a newSdk()and a new client for every single API call. A region job doing 200 calls builds 200 clients.The SDK memoizes API models statically so this is not catastrophic, but it is pure waste.
Change
Memoize the client per (service, region) for the lifetime of the scanner instance.
Natural to do alongside PERF-5, which touches the same construction path.
Priority: P2