Contribute Media
A thank you to everyone who makes this possible: Read More

E-Commerce with Django at Scale: Effective Performance Lessons Learned

Summary

E-Commerce with Django at Scale: Effective Performance Lessons Learned

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.

Details

Improve this page