prometheus.erl icon indicating copy to clipboard operation
prometheus.erl copied to clipboard

Slow Supervisor Boot Time

Open lswith opened this issue 6 years ago • 9 comments

Context: I've added the prometheus_ex library to my phoenix application. When I do this, my mix tasks and overall boot time for the whole application has gone up by a minute. I've started trying to determine where this occurs, and it's definitely happening the moment this application is added to the supervision tree.

Any thoughts on how I can improve runtime boot time?

lswith avatar Jun 26 '18 03:06 lswith

This might happen because of collectors autodiscovery. To check that you can configure collectors list manually (note default alias) https://github.com/deadtrickster/prometheus.erl#configuration

deadtrickster avatar Jun 26 '18 03:06 deadtrickster

I love the quick response!

I've actually set the default_collectors to an empty list to test the boot time performance and its still very similar.

lswith avatar Jun 26 '18 04:06 lswith

So, setting the instrumenters to an empty list as well as the collectors solved the boot time issue. Any ideas what might be the reason for this?

lswith avatar Jun 26 '18 04:06 lswith

Not sure, what you mean by instrumenters?

deadtrickster avatar Jun 26 '18 04:06 deadtrickster

you can configure config :prometheus, instrumenters: [].

lswith avatar Jun 26 '18 04:06 lswith

I think the issue might be in this module: https://github.com/deadtrickster/prometheus.erl/blob/master/src/prometheus_misc.erl

Getting the default instrumenters seems very slow.

lswith avatar Jun 26 '18 04:06 lswith

I'm just curious what the default instrumenters are? if I wanted to set this configuration to the default, what would it be?

lswith avatar Jun 26 '18 04:06 lswith

hmm looks like this is a leftover from the past, I was trying to automate instrumenters set up like declaring metrics, but due interactive/embedded mode differences it's not possible to do that reliably. As a temporary fix please add instrumenters: [] to the prometheus config. I'll remove it entirely I think.

deadtrickster avatar Jun 27 '18 07:06 deadtrickster

Any progress on optimising this? The module_info spam is still causing 9 seconds of startup time for me, a bit annoying for a fast TDD cycle when tests take so long to start

dylan-chong avatar Jul 22 '22 06:07 dylan-chong