PromPHP / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
423 stars 93 forks source link

Very slow usage with large REDIS KEYS count #105

Closed jquick closed 1 year ago

jquick commented 1 year ago

Hello,

We are using version 2.3 of this client and its been working great until the Redis DB started to balloon. We are writing metrics to REDIS in PHP threads which is causing lots of duplicates and total number of keys. We can see anywhere from 100-200k KEYS. This causes the RenderTextFormat to never return.

We are looking into maybe just flushing the DB every render to keep it small (every 10 sec). Is there a better way to handle this or some way to set generic/non-changing key names instead of:

PROMETHEUS_summary_METRIC_KEYS:panda_requests_trackerall:W10=:value:63bdd2f417f0e4.82673862
PROMETHEUS_summary_METRIC_KEYS:panda_requests_trackerall:W10=:value:63bdd38696a042.04345791
PROMETHEUS_summary_METRIC_KEYS:panda_requests_trackerall:W10=:value:63bdd33908d485.81089573
PROMETHEUS_summary_METRIC_KEYS:panda_requests_trackerall:W10=:value:63bdd488b3f4b7.30254979

So they just get overwritten?

Thanks for help!

LKaemmerling commented 1 year ago

Hey @jquick,

please have a look at https://github.com/PromPHP/prometheus_client_php/pull/99. This will be a new storage engine that comes with the next release. Could you please test it against your workload?

Basically, your issue is already handled in https://github.com/PromPHP/prometheus_client_php/issues/92, I would therefore like to move it to this issue :)