Optimizing Django for building high performance systems
Sanyam Khurana (~CuriousLearner) |
Many amateur developers who picks up Django write code which seems to work, but fails at scale.
Django has been made as a
The web framework for perfectionists with deadlines, and perfection is often forgotten due to deadlines. In this talk, we'll discuss about common pitfalls to avoid while working on a Django based web application. The talk would revolve mostly around the following:
- Profiling our web application to know exactly what queries are being executed on the database.
- Making optimal use of Django ORM to avoid multiple queries to the database.
- Usage of
n+1queries problems to database with ORM.
- Making use of
Asynchronous requeststo avoid creating a backlog for the request-response cycle. A little bit about task queues like Celery.
- Caching: Different types of caches to use -- both django caching as well as something like in-memory Redis cache.
In the end we'll look at an overall architecture of entire Django web application including wsgi, nginx, caching and database layer. This would provide a starting point to write clean code and optimizing Django Applications to the audience
- Hands-on experience with developing Django Applications
- Basic understanding of Django ORM including usage of
Slides for the talk is work in progress and would be updated on the above link
Sanyam is an Open Source Contributor from Delhi, India. Mostly goes by
CuriousLearner all over the web. He contributes to various upstream projects in different organizations & maintains a few of them. He has contributed various patches and bug reports upstream to Gecko Engine from Mozilla Organization.
He is a vouched Mozillian & an official Representative of Mozilla and has been listed in
AUTHORS as well as
credits section of every browser ever released by Mozilla. He mentored for PyDSA in RGSoC 2017. He volunteers for PyCon India and PyDelhiConf and has been an active member of PyDelhi, ILUG-D, LinuxChixIndia and DGPLUG.