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

Icinga's initial threads are linked to core count in host with no way to adjust or limit #9147

Closed
froooooooo opened this issue Dec 21, 2021 · 12 comments · Fixed by #9643
Closed
Assignees
Milestone

Comments

@froooooooo
Copy link

Currently the number of threads spawned is tied to the number of cores/cpu-threads the host running icinga has. Ideally, we would like to reduce the number of threads icinga needs to just run off of 1
initial thread if possible.

It seems this used to be possible with the init.conf but this was removed a while ago. For example, the value I'm referring to when doing checks is this. The below command shows the threads per icinga.

18-core-host # icinga2 console -e Concurrency
18

4-core-host # icinga2 console -e Concurrency
4

128-core-host-with-2-threads-per-core # icinga2 console -e Concurrency
256

To Reproduce

  1. Start icinga and check via icinga2 console -e Concurrency
  2. This number correlates directly to the number of cpu-threads which also is 1 icinga process per core/cpu-thread on startup

As shown above, this will change depending on the number of cores the host's cpu has.

Expected behavior

I would prefer a way to minimize this. We are pinning icinga to one core on our hosts, so in theory we should only require 1 thread (based on this logic), however it is still spawning a bunch of threads.

Your Environment

Include as many relevant details about the environment you experienced the problem in

  • Version used (icinga2 --version): 2.13.1-1
  • Operating System and version: Rhel6/Centos 7
  • Enabled features (icinga2 feature list): Enabled features: api checker mainlog

Additional context

I can get any more info if needed. But this is a huge concern for our environment. Thank you!

@leeclemens
Copy link
Contributor

@Al2Klimov
Copy link
Member

Have you tried const Concurrency = 1?

@froooooooo
Copy link
Author

Have you tried const Concurrency = 1?

Where should I set this?

@Al2Klimov
Copy link
Member

E.g. in the constants.conf.

@froooooooo
Copy link
Author

So it looks like this doesn't help. I tried with both const Concurrency = 1 and const concurrency = 1, but both had the same results ie. 1 thread per core.

@Al2Klimov
Copy link
Member

Hmm... and -DConcurrency=1 in the systemd file just after icinga2 daemon?

@froooooooo
Copy link
Author

No changes as well with this added to systemd.

@Al2Klimov
Copy link
Member

Have you done systemctl daemon-reload before restarting Icinga 2?

@julianbrost
Copy link
Contributor

IIRC one of the insights when looking at #9099 was (of course not written down) that there are some places where the number of thread can't be easily controlled by the user at the moment:

IoEngine::IoEngine() : m_IoContext(), m_KeepAlive(boost::asio::make_work_guard(m_IoContext)), m_Threads(decltype(m_Threads)::size_type(std::thread::hardware_concurrency() * 2u)), m_AlreadyExpiredTimer(m_IoContext)

ThreadPool(size_t threads = std::thread::hardware_concurrency() * 2u);

@Al2Klimov
Copy link
Member

6414ce3

@froooooooo
Copy link
Author

Have you done systemctl daemon-reload before restarting Icinga 2?

yes I did and still no luck.

@Al2Klimov
Copy link
Member

6414ce3 from #7845 may help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants