Supercharge Your Django Apps: Unveiling Performance Secrets with the Magic of Django Silk!
Vishrut Kohli (~vishrutkohli) |
Description:
Abstract: In this talk, we will take an in-depth look at Django Silk and explore how it can help optimize database queries, detect N+1 queries and other performance issues, and improve the performance of your Django applications.
Outline:
- Introduction (2 minutes)
- About me and what I do
- Importance of performance optimisation in web development
- What is Django Silk? (2 minutes)
- A performance profiler and optimisation tool for Django
- Allows you to monitor SQL queries, view rendering times, cache usage, and more
- Provides real-time insights into your application's performance
- How to install and Configure Django Silk (2 minutes)
- Adding Django Silk to your project
- Configuring the profiling middleware
- Enabling the admin interface
- How to profile Your Application (3 minutes)
- Collecting request/response data
- Logging SQL queries
- Measuring template rendering times
- Identifying slow views and URLs
- Profiling Django Views (3 minutes)
- Understanding the Silk middleware
- Enabling and disabling profiling
- Analysing view execution times and SQL queries
- Identifying slow-performing views
- Optimising Database Queries (3 minutes)
- Common query optimisation techniques
- Detecting and fixing N+1 queries
- Utilising querysets and aggregation
- going beyond just using .select_related(), .prefetch_related()
- Real-Time Debugging (2 minutes)
- The Django Silk shell
- Debugging performance issues live
- Best Practices (3 minutes)
- Configuring Django Silk for production
- Integrating it in your development workflow
- Using Silk's request filtering and grouping
- Analysing Silk's timeline visualisation
- Lessons learned and insights gained from real-world projects
- Conclusion and Q&A (5 minutes)
Key Takeaways:
- Install and configure Django Silk to profile your Django application
- Analyse performance data to detect bottlenecks
- Optimize database queries using techniques like N+1 query detection
- Utilize real-time debugging to fix performance issues on the fly
Target Audience: Django developers looking to optimize their application's performance.
Prerequisites:
Prerequisites:
- Basic knowledge of python and Django.
- Basic knowledge of web development.
- Good sense of Humour and love for Gifs.
Video URL:
https://youtu.be/_NXhT_FK52U
Speaker Info:
I am Vishrut, a 26-year-old Senior Software Engineer at MilkBasket (India's largest and most sustainable grocery delivery service), leading consumer applications and platform. Prior to this I led the last mile team at Blinkit(India's largest quick commerce service) . Python has been my primary tech stack since i started coding and this journey started from building a data server hosted on my raspberry pi to building a high performant delivery partner allocation system for our 10 min delivery service which handles more than 100k orders/ min flawlessly. I live to build high performant software in python and love to share my learning along the way.
Speaker Links:
- https://github.com/vishrutkohli
- https://www.youtube.com/watch?v=rk8RE8HYecg --> pycon 2020 talk
- https://www.youtube.com/watch?v=-Xgv4ZVWORg ---> conf42 2021 talk