Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: Adds code caching for faster framework loading #142

Merged

Conversation

LordHepipud
Copy link
Collaborator

@LordHepipud LordHepipud commented Nov 4, 2020

Current Situation

Currently the entire Framework is taking a huge amount of time to load the files. This causes several issues:

  • Slow loading increases the runtime of checks
  • High CPU usage for the initial loading of the Framework
  • High CPU usage over a longer period of time, cause more impcact on the systems

Possible solutions

Add caching

To reduce the impact for the Framework loading, we could add a cache file containing all Cmdlets, Enums and Functions allowing us to import file on initialization instead of having of to search for all .psm1 files and load them one by one

Use Nested Modules for PowerShell Plugins

PowerShell plugins right now are using Use-IcingaPlugins which searchs for all .psm1 files inside the plugin folder to load them. We should use NestedModules here, as the overall impact is lower. On Framework side we can't do this how ever without loading times to explode. Plugins are tracked at issue #87 here

Current Status

Mitigated

Usage

You can enable/disable this feature by using Enable-IcingaFrameworkCodeCache and Disable-IcingaFrameworkCodeCache. Updating the cache is done with Write-IcingaFrameworkCodeCache

Issue reference: #131

@LordHepipud LordHepipud self-assigned this Nov 4, 2020
@LordHepipud LordHepipud added the Enhancement New feature or request label Nov 4, 2020
@LordHepipud LordHepipud added this to the v1.4.0 milestone Nov 4, 2020
@LordHepipud
Copy link
Collaborator Author

Without caching:

IcingaForWindows_Old_no_caching

With caching:

IcingaForWindows_New_with_caching

Still not perfect but the performance is a lot better and the system itself feels smoother

@LordHepipud LordHepipud force-pushed the feature/add_code_cache_for_faster_framework_loading branch 2 times, most recently from aab20bc to 58ad808 Compare November 6, 2020 14:59
@LordHepipud LordHepipud force-pushed the feature/add_code_cache_for_faster_framework_loading branch from 58ad808 to 37c0824 Compare November 6, 2020 15:07
@LordHepipud LordHepipud modified the milestones: v1.4.0, v1.3.0 Nov 6, 2020
@LordHepipud LordHepipud mentioned this pull request Nov 6, 2020
@LordHepipud LordHepipud merged commit 2deeb83 into master Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Improve Performance of Framework to reduce initialisation impact High CPU usage
1 participant