Monday 2:50 p.m.–3:15 p.m.
E-Commerce with Django at Scale: Effective Performance Lessons Learned
Nate Pinchot
Audience level:
- Intermediate
Description
Two years ago our multi-million dollar E-Commerce site was processing thousands of orders per day through a performant and functional, but quickly aging, ASP classic codebase.
Now, we process those same orders, using our shiny new and Django/Python codebase. I'll take you through some performance lessons we've learned and show you how you can apply them to your own codebases.
Abstract
I'll take you through the most effective performance lessons we've learned and show you how you can implement them (with example code).
Two-pass Caching with Class-based Views
By far, this is one of the most effective performance optimizations we have done in terms of HTTP response time.
Using class-based views, we are able to do two-pass caching. On the first pass of the view, we render everything that's not specific to the user. No AJAX calls needed to get user specific content on the page. I'll show you how.
Data Caching Strategy
I'll review how we use multiple levels of data caching to greatly improve the amount of time it takes to rebuild the entire cache.
DB Read Replicas for Performance / Custom Backend for Failover
Read replica databases are great for performance. You've set up a few read replicas and implemented a fancy new database router which sends read queries to the read replicas (round robin) for any data that doesn't need to be up-to-the-millisecond fresh (e.g. blog posts, product descriptions).
You're sitting back and relishing in the improved performance when one of your database read replicas goes offline. Now what? I'll show you how we implemented a custom database backend to handle this gracefully.
Migrations Rules
This is less of a performance optimization and more of a set of rules we try to stick to. I'll review some snafus we've had and how we avoided future production issues while keeping the site at 99% uptime.