I am about to launch a django/mysql based site. I talked to a blogger about my site and she said "brilliant" and "huge potential", so now I am a bit worried about how well I can handle all the internet rushing in all at once... (She is willing to write a review and has roughly 10000 twitter followers & 30000 monthly visitors, which is not a problem unless they all decide to visit at the same time :-) )
Steps I have taken:
Now, I can't decide should I move to managed dedicated server or buy many accounts (maybe replicating db + using one account as load balancer?) to best handle the site launch. There is not that much data yet, so each account should be able to fit mysql (*) + (replicated) db + memcached in memory for some time.
(*) It seems that I would need to build my own mysql for replication, but I think I should still be able to fit everything in memory.
I am looking for some sort of estimate of how many accounts would be equal to one dedicated server in my situation. Also, practical solutions for handling load balancing of secure django sites are very welcome.
Somehow I am thinking the dedicated machine might not have that big advantage as everything should fit in memory and the most expensive part is likely to be the read queries that can be distributed. Ah, it would be so simple if a "Dedicated 1" machine was equal to 25 shared accounts :-)
Any help is greatly appreciated!
asked Jun 17 '12 at 15:40
In general a Dedicated server is always better than any number of Shared accounts.
There are many reasons, but the general idea is with a dedicated machine you will have all the CPU cores, and RAM, other resources all working for your application. Doing load balancing between multiple shared machines will always have replication latency, and other technical issues you will have to engineer around, which would not be needed on a Dedicated server.
The real question for most people is cost, and 'overkill'. Does your application justify the cost of that much power?
Its impossible to give you a direct answer, since anything involving load balancing and other optimization all take real-time testing to see the data, without the data its only a guess.
To get the data you would use a series of tools,
ab can be used to benchmark the web-server's request handling. I normally run this on the server itself so i know what the server alone is doing, but it can be ran from your location and get times which monitor the distance from your location to the server. A basic command would look like this,
This would hit the server with 10 concurrent requests, 100 times, than provide statistics. This is a way to generate false load to see what happens if your site, or any particular page, is hit with many users at once.
Lastly you as the Django developer has to be in the mindset to always look for code that could be written more efficiently, in Django this typically means writing clever Querysets which get the data you need with the smallest Database query possible. However it applies to all of the python code you write. This just takes a lot of practice and reading of the official docs to understands how it does what it does. Using tools like the Django Debug Toolbar can help too.
Using these practices Django developers can get high volume sites working within our Shared plans.