til
til copied to clipboard
Kong - multi process with Prometheus
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: https://github.com/Kong/kong/issues/8844