I'm trying to profile a django app running under uWSGI. Linesman looks interesting, but I've got no idea how to actually use it. Could someone help with detailed instructions for this use case? Or direct me to some other better documented solution?
Edit: There are a number of posts here and elsewhere that discuss profiling specific views, django's ORM, etc. This is NOT what I want. I'm trying to see why this app+django+uwsgi stack is slow on a specific hardware platform. Since just about everything I've come across only profile parts of django or seem to require running the code in question with a specific commandline, I'm stumped. I need specific, "for-morons" directions for this specific stack.
Edit2: I'm working pro-bono on a GPLv3 project. So, unless you also know how I can hack my bank balance :), I'm sticking with FOSS solutions.
Gunicorn and uWSGI are primarily classified as "Web Servers" and "Web Server Interface" tools respectively. Gunicorn and uWSGI are both open source tools. Gunicorn with 5.96K GitHub stars and 1.12K forks on GitHub appears to be more popular than uWSGI with 2.5K GitHub stars and 541 GitHub forks.
Can I then ditch NGINX? uWSGI could be used as a standalone web server in production, but that is not it's intentional use. It may sound odd, but uWSGI was always supposed to be a go-between a full-featured web server like NGINX and your Python files.
A bit late but I just got linesman at least partially working, by following the Django notes at the linesman doc page.
Just add the necessary code shown in the linked page to wsgi.py and start the uwsgi server. After that, go to the URL of your django instance with the profiler path. E.g. when you run django on http://example.com:8000/
, go to http://example.com:8000/__profiler__
. It's important to note that the documentation of linesman always assumes that the server runs on port 5000 and I initially thought that it creates a small webserver on it's own on port 5000 for that, but it doesn't do this obviously :)
You might want to consider using New Relic.
http://blog.newrelic.com/2011/11/08/new-relic-supports-python/
As well as targeted instrumentation, including special support for Django, a low overhead thread profiling mechanism has also been added recently. Overhead is low enough that can even be used in production systems.
UPDATE 1
The point in suggesting New Relic is that it is relatively easy to install and get running even on uWSGI.
For your situation of not wanting to spend any money, it has a free trial period of 2-4 weeks depending on where you sign up through and whether you are trying to claim the free T-Shirt or other promotions such as free RC Helicopter that they sometimes run. Even after the trial period it goes back to a Lite subscription level which costs no ongoing money and which still gives a fair bit of detail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With