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

Kong - multi process with Prometheus #200

Open
xluffy opened this issue Jul 6, 2023 · 2 comments
Open

Kong - multi process with Prometheus #200

xluffy opened this issue Jul 6, 2023 · 2 comments

Comments

@xluffy
Copy link
Owner

xluffy commented Jul 6, 2023

Kong Gateway is built on top of OpenResty/Nginx, which is a multi-process single-threaded architecture. To collect and aggregate metrics from different processes, we implement the Prometheus plugin with shared memory.

Nginx handles requests in a non-blocking way and is normally very efficient. However, every read and write operation to the shared memory requires a mutex lock to lock the critical section and will block all worker processes from processing requests. When the plugin is used to monitor metrics with high cardinality, it can affect Kong Gateway performance significantly, especially increasing the long tail latencies

https://konghq.com/blog/engineering/how-to-use-prometheus-to-monitor-kong-gateway

Nice discussion here, must read: Kong/kong#8844

@xluffy
Copy link
Owner Author

xluffy commented Jul 7, 2023

@xluffy
Copy link
Owner Author

xluffy commented Jul 11, 2023

https://gitlab.com/gitlab-org/ruby/gems/prometheus-client-mmap

This Prometheus library is fork of Prometheus Ruby Client that uses mmap'ed files to share metrics from multiple processes. This allows efficient metrics processing for Ruby web apps running in multiprocess setups like Unicorn.

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

No branches or pull requests

1 participant