-
Notifications
You must be signed in to change notification settings - Fork 578
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
Evaluate memory overhead of icinga::Locked<...> in object attributes #10113
Comments
.ti attributes of a Service: about 90. Ex. numbers and bools: about 30. (icinga2 console > So, every Service consumes +1.2KB (30 x 40) with |
That gives no estimate on the big scale of things, i.e. how this affects the overall memory usage. There are more object types than just |
I've been testing this for the entire week now and couldn't find a way to exactly determine the differences with and without this mutex. Attaching GDB to the running icinga2 process and calling Setup (Debian 12 (Icinga 2 linked to
|
I see two different construction areas:
While the first one must be addressed ASAP, otherwise even 1 TB RAM wouldn't(?) help, the second one is, without doubt, much less problematic. At best no one even notices, at worst(!) people already have fixed it with one more RAM stick. And I even believe that, as so often, the truth is somewhere in the middle. Hence, I opt for commenting-out this discussion from the upcoming bug fix release. |
As a countermeasure for race conditions, #9364 added a mutex for every object attribute with a type that's incompatible with
std::atomic
. At the moment, that's implemented using a dedicatedstd::mutex
for every attribute for every single object. On my machine,sizeof(std::mutex) = 40
, and if I compare thesizeof(icinga::Host)
with and without these mutexes, that's a 70% increase. However, that won't result in a 70% increase in memory usage of Icinga 2 as a whole (for example, all strings like object names are dynamically allocated and thus not part oficinga::Host
itself and aren't affected by this increase.Tasks
Figure out how much of an effect this has on the total memory use of Icinga 2.
Improve this. One idea would be to take some inspiration from how something like
atomic_load(const std::shared_ptr<T>*)
is/can be implemented:Note that if using only part of the address as the key, i.e. sharing the mutex between objects, this would reduce the memory requirements.
The text was updated successfully, but these errors were encountered: