Working with API calling Scripts

Product: PowerShell Universal
Version: 2.10.2

Hi !

I’m willing to call a script (automation tab) from an API but it’s pretty slow. I having a pretty simple powershell script that is called from an API endpoint, the script itself executed with powershell run pretty fast, but as soon as I configure the API endpoint to call the script it take something like 4-5 seconds to get an output.

I’ve tried with persistant runspaces / high perf runspace etc and nothing change much in term of performance :frowning:

The API endpoint is configured as follow :

 Invoke-PSUScript -Name 'Get-Machine.ps1' -machine_name $name -Integrated | Tee-Object -Variable Job | Wait-PSUJob -Integrated
    Get-PSUJobPipelineOutput -Job $job -Integrated | ConvertTo-Json -Depth 10 -AsArray

and the script is simply a get-ADcomputer with the machine name.

Any Idea how it would be possible to get it executed faster ?

PSU Runs as a Windows Service and nothing has been done to tune it in any way

Many thanks in advance !

Let’s resurrect this topic!
I am also struggling with API performance (although not via the same route the OP was on). I have short scripts under endpoints that are taking way longer than normal to execute but the visibility on this is nil. I have App Insights setup on the API site. It shows the duration of calls increasing as I increase load. But the metrics involved are not clear. CPU and RAM are barely utilized. Runspaces seem to be available by checking that hidden chart available under the Processes link on the Home page. Many available runspaces. But REST API calls sometimes take well over a minute.
I’ve posted elsewhere how my PU log file is useless as its full of gRPC exceptions that I’ve asked about over and over. So I can’t really use that to glean anything useful unless I know what to search for.
What can users do to assess each level of API endpoint response time? Anything?