

























Gunicorn, or Green Unicorn, is a UNIX-compatible WSGI HTTP server that is commonly used to run Python applications. Developed in 2010 by Benoit Chesneau, this open source project is similar to uWSGI, mod_wsgi, and CherryPy. Gunicorn is often implemented with a reverse proxy server like NGINX, which typically handles requests for static resources and then passes on the requests to Gunicorn. Gunicorn processes the dynamic portion of the request and returns a response to NGINX, which sends the response back to the client.
Gunicorn can be used to serve Python applications and is compatible with frameworks like Django and Flask. It’s easy to configure, lightweight, and only needs 4–12 worker processes to handle hundreds or thousands of requests per second.
As shown in the screenshot above, Datadog’s out-of-the-box Gunicorn dashboard shows you information ranging from resource utilization to work metrics such as request duration and the rate of successful requests. With Datadog, you can start monitoring Gunicorn’s performance alongside other elements of your infrastructure, so you’ll be ready to investigate issues when they arise.
Our integration with Gunicorn collects several categories of metrics:
gunicorn.requests, the number of requests per secondgunicorn.workers, so you can make sure you are designating the right number of workers to support your applicationNote that in order to collect most of the metrics listed above, including status codes and request duration, you will need to point Gunicorn to your StatsD server, as outlined here.
You can use Datadog to monitor Gunicorn alongside NGINX and custom metrics from your web application to understand what’s happening in your infrastructure. In the screenshot below, you can see that the number of busy Gunicorn workers, the 95th percentile of Gunicorn request duration, and average NGINX connections peak at roughly the same time.
You can also correlate Gunicorn metrics with events like code deploys. For example, the screenshot below shows the number of 5xx errors overlaid with all releases tagged “hotfix” (indicated by the pink bars). If any particular hotfix event correlates with a spike, you may want to investigate if that update caused issues for your web servers.
Create alerts to keep tabs on Gunicorn and make adjustments to your configuration when needed. For example, you may want to set up alerts to find out when:
gunicorn.workers) availableIf you’re already using Datadog, you can start monitoring Gunicorn by following these instructions. If you don’t yet have a Datadog account, sign up for a 14-day free trial here.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。