[Suggestion] Stream HTTP responses from rabbit_prometheus_handler
#14865
Unanswered
the-mikedavis
asked this question in
Ideas
Replies: 1 comment
-
|
Sounds reasonable, thank you for digging in. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
RabbitMQ series
4.1.x
Operating system (distribution) used
macOS
How is RabbitMQ deployed?
Other
What would you like to suggest for a future version of RabbitMQ?
When formatting the reply to requests of
/metrics/[:registry],rabbit_prometheus_handlerusesprometheus_text_format:format/1to build the response in Prometheus text format. Under the hood that function is building the response by writing into aram_file.ram_fileis a port (driver) wrapping a growable vector of bytes.Buffering the whole response is necessary when the
content-encodingisgzip, but foridentitywe could instead stream the response withcowboy_req:stream_reply/3andcowboy_req:stream_body/3and avoid buffering the response at all. I expect that this would be a nice improvement to the endpoints' memory use, which is valuable because some registries likeper-objectcan send large responses on clusters with many objects.To do this we would need to add a new formatting function to
prometheus_text_format, sayformat_into/3which would accept a function to pass data into, which would befile:write/2for the default implementation.format_into/3 function...
This change might be hard to measure precisely since memory allocated by a port driver is not tracked by the VM. Instead we would probably want to measure available memory while spamming
/metrics/per-objecton a cluster with many queues for example (like the100k-classic-queues.jsonsample-config).Beta Was this translation helpful? Give feedback.
All reactions