Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am primarily a web-application developer, and I do not know much about scaling/scalability techniques. My application is written in Python, using Django; a fairly standard setup.

I currently use Apache 2.2 for my webserver, and MySQL for my database server; both running on the same VPS.

Up until now, it was basically a prototype and merely 15-30 concurrent users at any given time; so I had no issues, but now since we'll be adding more users we'll have performance issues.

So my question is how do I go about scaling my web-application? My current plan is as follows:

  1. Now I have just one vps server running, apache + MySQL.
  2. Next, I plan to add another vps server, to run only MySQL, so I'll have one webserver and one DB server.
  3. Next, I'll add memcache to the webserver for caching data, to take some load off MySQL.
  4. Next, another web-server for serving all the static content.
  5. Next, a VPS server for load-balancing (nginx/varnish) behind which would be my two web-servers and then db-server.

Does that sound like a workable strategy? Please guide me around here.

share|improve this question

3 Answers 3

Do you know where your first bottleneck is? If not, how did you laid out the order of things to do?

That said, if you haven't done anything terribly wrong in your app the first limit you'll probably hit will be disk I/O caused by the db and your strategy will probably be a good choice.

Moving the db to another physical disk should help a lot and be your first thing to do. As an example, depending on the systems you're using there could be no difference or a big difference between using a second disk on the current host or moving to an entirely separated server. You're running on VPSes, if you're disk I/O bound moving to a second VPS won't probably help much if it happens to use the same storage (same disk or same SAN or whatever) - but this last one is an issue that should be addressed by your vps provider.

share|improve this answer
    
are there any real projects case-studies, or guides that could be referred for this ? –  phoenix24 Jun 16 '10 at 13:46

I'd recommend reading Scalable Internet Architectures by Theo Schlossnagle. The book describes all of the theory and practice of scaling applications between servers, ensuring no single points of failure, scaling databases, etc.

Your plan does sound like the first progression of scaling though. Usually everything starts on one server, then you split web and database, then add a reverse proxy or load balancer and run multiple web servers, and so on.

share|improve this answer

You can't improve what you don't measure. First you should see what your bottleneck is. You can use atop now, and set up some kind of monitoring if you haven't already. If everything is running well, you can generate realistic load using JMeter.

Here is some more perspective on the infrastructure to build around your Django app.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.