Django-live-profiler is a low-overhead data access and code profiler for Django-based applications.
Rationale
Profiling web applications on a development environment often produces misleading results due to different patterns in the data, different patterns in user behavior and differences in infrastructure.
All existing DB access profiling solutions for Django seem to be focusing on a single request. However, in the real world certain queries might be negligible in a single request while still putting a considerable strain the database across all requests.
django-live-profiler aims to solve these issues by collecting database usage data from a live application.
Features
- Low overhead
- Application-wide profiling
- SQL profiler
- Python code profiling (statistical, using statprof)
- Built-in visualization
Installation
- Run
pip install django-live-profiler
- Add
'profiler'
app toINSTALLED_APPS
- Add
'profiler.middleware.ProfilerMiddleware'
toMIDDLEWARE_CLASSES
- Optionally add
'profiler.middleware.StatProfMiddleware'
toMIDDLEWARE_CLASSES
to enable Python code statistical profiling (using statprof). WARNING: this is an experimental feature, beware of possible incorrect output. - Add
url(r'^profiler/', include('profiler.urls'))
to your urlconf
Usage
In order to start gathering data you need to start the aggregation server:
$ aggregated --host 127.0.0.1 --port 5556
Visit http://yoursite.com/profiler/ for results.
Contributing
Contributions are welcome via GitHub pull requests.