Bug #22823
open
In puppet setup with large number of environments and classes it's possible for smart-proxy to run out of memory
Description
This is partially due to calls like https://github.com/theforeman/foreman/blob/develop/lib/proxy_api/puppet.rb#L30 or https://github.com/theforeman/foreman/blob/698e916ce208b5040b83a908a058c83c94d158ee/app/services/proxy_status/puppet.rb#L4. which are incredibly expensive. Moreover, the results of these calls are cached both on proxy and Foreman sides, which would probably tip Foreman host memory requirements into "unreasonable" territory (the original BZ mentions more than 4000 puppet environments of total size of 50Gb).
If classes per environment environments are so important, we'll need to:
- create a persisted cache of counters
- create a scheduled task to periodically update the counters
- add counters retrieval call to smart-proxy puppet api
- update proxy puppet class cache to an LFU one