Product: PowerShell Universal Version: 3.7.14
I’ve noticed this odd behavior with scheduled endpoints where the performance seems to degrade over time… not by much, but enough that is creates a very unique pattern where every 4th run seems to have a longer run time. To be clear, the graph below shows a collection measured in milliseconds. A collection consists of 4 T-SQL queries (very fast, system dmv type stuff… no chance of blocking) fired off in a single batch (multiple active result sets is being used) across 5 separate servers (parallelized with powershell runspace via foreach -parallel). When I restart the service, the pattern still exists, but the bad runs don’t seem to be nearly as bad. Performance in milliseconds is being measured by using the Measure-Command in powershell to record the ENTIRE loop for all queries/servers grouped into a single collection.
Edit: image shows a reboot, but what I really meant was a PSU service restart.
Edit2: I am using Invoke-SqlCMd2 versus DBATools based on the fact that DBAtools is not recommended in dashboards and I wanted a lightweight equivalent.