janhoy commented on PR #3291:
URL: https://github.com/apache/solr/pull/3291#issuecomment-2760808394
Did some more testing and a weakness of the solution is that the Powershell
process is spawned once for every Java process running on the system, and each
invocation takes some 3-5 seconds on the Win11 VM on my MacBook. Don't know if
such slow invocation is representative for a real windows system, but it is an
overhead. I have not done a comparison for the old wmic invocation. Manual
command invocation in a PS terminal takes <1s. While manually invoking
`powershell.exe -Command "foo"` from a CMD terminal takes 2+ secs, perhaps
there's a startup cost in starting powershell process.
So I refactored the code to instead of calling PS once per PID, we do one
full PID list on startup with
```
"Get-CimInstance -ClassName Win32_Process | Where-Object { $_.Name -like
'*java*' } | Select-Object ProcessId, CommandLine | ConvertTo-Json -Depth 1"
```
and stuffs it into a `Map<Long, String>` for later lookup.
The OSHI library, using jna would probably be far more performant, but I
agree that adding a 1Mb jar just for this is too much.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]