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

Database Sharding with Django

Description

Database Sharding with Django

Wednesday 4 p.m.--4:45 p.m.

Audience level: Intermediate

Description

Django works great for single database webapps, but did you know they give us the tools to create webapps with sharded data right out of the box? This talk will go over how we leveraged Django's features to add sharding to our webapp infrastructure. Abstract

Topics to cover:

  1. Why do you need to shard your data? lots of data lots of writes
  2. What should you do before sharding? Scale up - throw money at it. Feature partitioning - split feature data on different databases Sharded databases.
  3. How to set up multiple databases in Django tools that we used at Wave. Talk about what Django gives us right out of the box (DB Routers) How database routers work. Gotchas when using South for DB migrations.
  4. The downsides of multi-database systems. what we lose (ForeignKeys, Transactions management, select_related(), prefetch_related())
  5. Scaling the database via sharding. what does this mean? how do I pick a key to shard on? what makes a good and bad sharding key?
  6. Database routers for sharding.
  7. New tooling that needs to be written to deal with database migrations. deal with database migrations
  8. How to interact with your data through the ORM when it's sharded.
  9. Need to start using Globally Unique PK's go over a few different strategies used by other companies. strategy for unique ID generation in Python.
  10. Transactions + Sharded data. transactions are only useful on same-shard
  11. Balancing sharded data across servers we chose multiple DB's per node. make db migration a DevOps task. downsides (limited db connections).

Details

Improve this page