Skip to content

Optimize-IcingaForWindowsMemory causes high load #491

@haxtibal

Description

@haxtibal

#405 fixed a memory leak (thanks!) by calling Optimize-IcingaForWindowsMemory for each accepted REST API connection. This effectively means for each HTTP request, because in most scenarios a client sends only one request per connection.

Sadly Optimize-IcingaForWindowsMemory seems to be expensive. Wrapping it in Measure-Command

$ts = Measure-Command { Optimize-IcingaForWindowsMemory -ClearErrorStack; }
Write-IcingaConsolePlain -Message '{0}: Optimize-IcingaForWindowsMemory took {1}s' -Objects (Get-Date -Format HH:mm:ss.fff), $ts.TotalSeconds;

reveals execution times of 0.5s on our 2 core virtual machine (varying, but at same magnitude).

16:49:04.928: Optimize-IcingaForWindowsMemory took 0.4907853s

And so Optimize-IcingaForWindowsMemory may well take more time than the actual measurement. For a reference, Get-WmiObject takes 0.3s on the same host.

@LordHepipud Can you confirm this? Our affected machines had undergone hardening measures where it's difficult to estimate impact. However, if confirmed, I'd offer to help in finding an improvement.

Metadata

Metadata

Assignees

Labels

EnhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions