aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 78 forks source link

AWSPowerShell.NetCore help is very slow to load #174

Closed bender-the-greatest closed 3 years ago

bender-the-greatest commented 3 years ago

Description

When using the Get-Help cmdlet with any of the AWSPowerShell.NetCore cmdlets, it takes anywhere between 30 seconds to 2 minutes to bring up the help for that cmdlet. Even calling one of the cmdlets with -? takes a while to load. This is particularly annoying as I look up details of these cmdlets quite often. With other modules and built-in cmdlets the help loads nigh immediately, this is only occurring with cmdlets from the AWSPowerShell.NetCore module.

This is also causing a major spike in the memory usage of my PowerShell process the first time I call Get-Help on one of the cmdlets. If I don't always use the same PS session to look up cmdlet help, I can (and have) hit a case where my system starts swapping like crazy, and eventually I either need to kill off my PowerShell sessions or risk having to hard reboot if my system deadlocks when totally out of swap space.

Reproduction Steps

  1. Run Get-Help Some-AWSPowerShellCmdlet or Some-AWSPowerShellCmdlet -?
  2. Wait for it to load... takes a while.
  3. Memory usage of PowerShell spikes hard (for me, from ~500MB to 2.8GB)

Logs

No logs to speak of

Environment


This is a :bug: bug-report

bender-the-greatest commented 3 years ago

I've added some before and after screenshots showing the memory usage before and after invoking Get-Help on a cmdlet for the first time in a session. The same thing happens if I open a new PowerShell session and call Get-Help from an AWSPowerShell.NetCore cmdlet there.

beforeHelp afterHelp

bender-the-greatest commented 3 years ago

I'm closing this out, I knew that AWSPowerShell.NetCore had been into several modules, but didn't realize that the monolithic module was close to a whopping 8000 cmdlets. I've uninstalled the AWSPowerShell.NetCore module and installed only the ones I need, which has improved the performance of the help loading, as well as no longer spiking my memory usage by 2GB+ per terminal session when the help is first loaded.