Skip to content

Reduce PowerShell Lambda INIT time by omitting unwanted files from pa…#2358

Open
sankettangade wants to merge 2 commits intodevfrom
stangade-perf-improvements-lambda
Open

Reduce PowerShell Lambda INIT time by omitting unwanted files from pa…#2358
sankettangade wants to merge 2 commits intodevfrom
stangade-perf-improvements-lambda

Conversation

@sankettangade
Copy link
Copy Markdown
Contributor

Description of changes:

New-AWSPowerShellLambdaPackage now strips files that have no purpose at Lambda runtime from AWS-authored PowerShell modules during packaging:

  • Files stripped: *.xml (PowerShell help XML, .NET XMLDoc, PowerShellGet metadata) and *.pdb (debug symbols).
  • Scope: Only AWSPowerShell.NetCore and AWS.Tools.* modules under the package's Modules/ directory. Third-party PowerShell modules are not touched.

Measured Impact

Cold-start INIT measured against a matched-runtime baseline (dotnet10, Microsoft.PowerShell.SDK 7.5.4, 512 MB, us-east-1, 100 cold starts each).

AWS.Tools.EC2 example (largest module tested):

Architecture Mean Init (Unstripped) Mean Init (Stripped) Δ ms Improvement %
x86_64 2563.7 ms 2448.6 ms −115.1 ms 4.49%
arm64 2939.6 ms 2805.6 ms −134.0 ms 4.56%

EC2 also showed a notable tail-latency improvement: P99 dropped from 4697.8 ms → 2954.4 ms on x86_64 (−1.7s).

Across services, the improvement scales with bytes stripped per module, averaging ~5% INIT reduction on chunky modules. All users of New-AWSPowerShellLambdaPackage benefit automatically with no script or invocation changes.


Test Plan

  • All Pester tests pass (Invoke-Pester PowerShell/Tests/)
  • Manual end-to-end packaging of STS, S3, EC2 handlers on x86_64 and arm64
  • Functions deployed to AWS Lambda and invoked successfully without Module load failed or Cannot find errors in CloudWatch logs
  • Cold-start benchmarks (100 invocations × 6 functions) compared against matched-runtime unstripped baseline

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sankettangade sankettangade marked this pull request as ready for review May 7, 2026 19:54
@sankettangade sankettangade requested review from a team as code owners May 7, 2026 19:54
@sankettangade sankettangade requested review from normj and philasmar May 7, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant