
django-silky is my fork of django-silk. It keeps the same app label, middleware
and settings, and carries upstream’s migrations unchanged, so switching is a
package swap plus manage.py migrate silk. 1.7.0 rebuilds the whole interface,
and it’s the first release I’d recommend trying even if plain silk works fine
for you.
The part I use most: open a request and, if it has an N+1, the panel names the
line in your code that runs the repeated query and suggests the
select_related() or prefetch_related() call that would batch it. It also
shows the endpoint’s usual time and query count, so you can tell a slow request
from a slow endpoint.
Three pages are new:
- SQL groups every recorded query by shape, with calls, total and p95 time,
and DB time per table. - Hotspots ranks lines of your app code by the database time they cause, and
flags the ones running inside a loop. - Compare puts two requests or two time ranges side by side, down to which
query patterns appeared or disappeared.
It’s also faster. On 5,000 recorded requests (76,000 queries) the Summary page
renders in 59 ms instead of 465 ms, and the requests list runs 13 queries for
its rows instead of 59. JavaScript per page dropped from 0.7 to 2.4 MB to 20 to
78 KB, jQuery and Bootstrap are gone, and filtering updates the list in place
instead of reloading. A few pages render a little slower on a cold cache
because they now show more (sidebar counts, the endpoint baseline). Every
figure is in benchmarks/README.md with the scripts to reproduce it.
Two things to know before upgrading. Migration 0010 adds two indexed columns to
silk_sqlquery and backfills them, which took about 10 s for 76,000 queries on
SQLite. If you override silk templates, check them against the new ones: the
old base templates are gone. URL names and SILKY_* settings didn’t change.
pip uninstall django-silk
pip install django-silky
python manage.py migrate silk
Repo, screenshots and migration guide: GitHub - VaishnavGhenge/django-silky: Silky smooth profiling for Django · GitHub
I’d like to hear what’s missing, especially from anyone running silk against
Postgres or MySQL with a lot of recorded data.