Scaling
From Django In Production
First of all, make sure you are doing everything mentioned in the Performance topic:
- Don't serve static media through Django
- Separate out the database server
- Monitor database queries
- Use memcached
- Turn off KeepAlive
This should get you a reasonable way down to the path to handling a medium amount of traffic. However, once your configuration starts to get overwhelmed you will have to start considering the following points.
Multiple databases
Currently, Django doesn't easily support connecting to multiple databases. That's not to say it can't be done, and there are a number of solutions you can put together to do this which could be put into production.
- http://www.eflorenzano.com/blog/post/easy-multi-database-support-django/
- http://www.mechanicalgirl.com/view/multiple-database-connection-a-simple-use-case/
There is ongoing discussion regarding putting a supported API for multiple databases into Django core.
- http://code.djangoproject.com/wiki/MultipleDatabaseSupport
- http://groups.google.com/group/django-developers/browse_thread/thread/9f0353fe0682b73
Buy RAM
RAM is cheap these days, particularly when compared to the cost of your time fine-tuning elsewhere. In a high-traffic web serving stack you can't have too much RAM.
What you're trying to minimize is disk IO. Start with the database server and try and get enough RAM to hold the whole thing in memory. After that max-out your web servers so that nothing ever swaps.
Dedicated cache servers
You should be making good use of caching by this point. So much so that it is worth considering adding some servers dedicating to running memcached.
These machines can be relatively low in CPU but with large amounts of RAM and at least one Gigabit Ethernet interfaces.

