4 ms·
I'm pretty much in love with Nginx' simplicity and capabilities as a swiss army knife for all kinds of HTTP magic. I had some doubts about Nginx' direction and
by moreentropy 9y ago
I'm pretty much in love with Nginx' simplicity and capabilities as a swiss army knife for all kinds of HTTP magic.
I had some doubts about Nginx' direction and feature development, but most really great features (like stream proxy with SNI support) make their way into the open source release. Built in monitoring sucks though. There are options for better monitoring your requests with Prometheus.
This project implements prometheus metrics using Lua scripting inside Nginx:
https://github.com/knyar/nginx-lua-prometheus https://github.com/knyar/nginx-lua-prometheus
This project is indended as a sidecar service to nginx and receives access logs and timings using syslog protocol (Nginx has a native syslog over UDP capabilities) so no scripting inside Nginx is necessary:
https://github.com/markuslindenberg/nginx_request_exporter https://github.com/markuslindenberg/nginx_request_exporter
(I'm the author of this exporter)
- unkown-unknowns 9y agoIs there any noteable difference in overhead between the two? Is there any difference in what data is able to be exported?
- moreentropy 9y agoI honestly don't know, I never made serious performance tests. The external exporter can make use of every variable that nginx is able to use in a log_format. I guess the internal Lua scripting has access to even more data. Performance wise I assume the external exporter has less impact on Nginx' operation because it doesn't keep shared state or run code inside Nginx at all (see https://github.com/knyar/nginx-lua-prometheus#caveats https://github.com/knyar/nginx-lua-prometheus#caveats), all Ngnix does is push out log records over syslog/UDP. If the exporter should overload that doesn't concern Nginx at all, what happens is that observations get dropped.
- SEJeff 9y agohaproxy tends to be lighter weight and higher performance. Also, haproxy gives (as this article mentions) a lot more information regarding status information, which can be used to monitor and manage the applications being load balanced. Also note that Willy Tarreau has been a Linux kernel guy for eons and does a lot of upstream kernel patches, some of which haproxy benefit from. Most recent example: https://github.com/torvalds/linux/commit/3979ad7e82dfe3fb94a51c3915e64ec64afa45c3 https://github.com/torvalds/linux/commit/3979ad7e82dfe3fb94a... Willy also was the long term maintainer of the 2.4 Linux kernel (yes... 2.4), and does a lot of maintenance with the long term 2.6 release. So many embedded companies rely on his trees for their devices it isn't even funny.
- unkown-unknowns 9y agoI was actually asking about the difference between the two exporters mentioned in the comment I replied to but thanks anyway.
- hdhzy 9y agoIs stream proxy with SNI supported by open source version of Nginx? I can't find any documentation on how to route TCP traffic based on SNI but I know haproxy can use SNI and ALPN for that.
- moreentropy 9y agoSee here: http://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html http://nginx.org/en/docs/stream/ngx_stream_ssl_preread_modul...
- hdhzy 9y agoNice. Exactly what I was looking for yesterday, thanks!
- mbubb 9y agoso glad to find this - will look at incorporating with our prometheus setup. We are using OpenResty so the luajit stuff is already in place. I am excited to see what this can do for us. thanks
- gshulegaard 9y agoJust curious but have you tried Amplify? Disclaimer: I am on the Amplify team at NGINX.
- moreentropy 9y agoNever tried, sorry.
- gshulegaard 9y agoWould love to have you try and give us some feedback via Intercom! https://www.nginx.com/products/nginx-amplify/ https://www.nginx.com/products/nginx-amplify/ It looks like you have some really good experience in tooling around metric collection surrounding NGINX. Edit: For reference, here are all the metrics we can collect...and I believe it to be a fairly complete list of notable metrics pertaining to NGINX performance: https://amplify.nginx.com/docs/guide-metrics-and-metadata.html https://amplify.nginx.com/docs/guide-metrics-and-metadata.ht...
- dominotw 9y ago>NGINX Amplify is a SaaS application, currently hosted in AWS. Is there a self hosted version?
- gshulegaard 9y agoAt the moment we do not have an on-prem or self-hosted solution. Currently, we are working on the NGINX Controller which will have an embedded Amplify within it to drive it's telemetry needs (and will be available in addition): https://www.nginx.com/products/nginx-controller/ https://www.nginx.com/products/nginx-controller/ If you are interested in an on-prem version I would love if you could give it a try. If it's something you think you would find useful in an on-prem scenario then please leave us feedback in Intercom! The more people that ask for it the more likely our product owners will prioritize it :)