Re:Ask HN: How do I prevent database bottlenecks on my web a...
by btilly on Tuesday August 24, 2010 @03:12AM
(#1629190)
My advice about scalability for someone at your stage is to focus on making your data model clean and well-organized. Try to avoid obvious mistakes (such as querying for the same data over and over again). Make your code as clean as you can.
If you followed this advice, you shouldn't break until dozens of dynamic pages per second. And then adding a caching layer like memcached for the most common queries should take you up into the hundreds.
At that point you need more scalability work, but should have the finances for it as well. This would be a Good Problem to have. Don't worry about it until you get there.
Incidentally the main reason to keep your data model clean is not to help scalability (though it does surprisingly well for scalability issues), but to make maintenance of your code easier. Because as your vision of the product changes, you will find your code changing. And a solid data layout will make that process easier. (The end result is never ideal. Be pragmatic in your trade-offs, but not cavalier.)
If you followed this advice, you shouldn't break until dozens of dynamic pages per second. And then adding a caching layer like memcached for the most common queries should take you up into the hundreds.
At that point you need more scalability work, but should have the finances for it as well. This would be a Good Problem to have. Don't worry about it until you get there.
Incidentally the main reason to keep your data model clean is not to help scalability (though it does surprisingly well for scalability issues), but to make maintenance of your code easier. Because as your vision of the product changes, you will find your code changing. And a solid data layout will make that process easier. (The end result is never ideal. Be pragmatic in your trade-offs, but not cavalier.)