Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Project Done and Working. Now What?

Tags:

django

I just finished what I would call a small django project and pretty soon it's going live. It's only 6 models but a fairly complex view layer and a lot of records saving and retrieving.

Of course, forgetting the obvious huge amount of bugs that will, probably, fill my inbox to the top, what would it be the next step towards a website with best performance. What could be tweaked?

I'm using jmeter a lot recently and feel confident that I have a good baseline for future performance comparisons, but the thing is: I'm not sure what is the best start, since I'm a greedy bastard that wants to work the least possible and gather the best results.

For instance, should I try an approach towards infrastructure, like a distributed database, or should I go with the code itself and in that case, is there something that specifically results in better performance? In your experience, whats pays off more?

As a personal contribution: I sometimes have the impression that some operations, when done through django's signals, are faster then the usual view way. But hey, I'm biased. I freaking loooove signals. :)

Personal anecdotes like mine, are welcome as a way to stimulate some research, but some fact based opinions are much more appreciated. :)

Thanks very much.

like image 371
rrb_bbr Avatar asked Feb 02 '23 23:02

rrb_bbr


2 Answers

here is what we did...

  1. used django-debug-toolbar to analyze performance of each page (# of queries and response times)
  2. used Django cache framework...most importantly memcache
  3. used Firebug's pagespeed to optimize HTTP page loads
  4. used Google Analytics for general site usage stats (find out what's being used)
  5. used Apache HTTP server benchmarking tool for quick performance stats

In general, don't try to optimize performance up front. First, collect usage/performance stats, then pick off the most rewarding changes (effort vs. benefit) until you get decent results. The goal should be to avoid unnecessary complexity (distributed databases, etc)

Then, if you still aren't happy, consider these (in order): more RAM (goes a long way), a dedicated database server, load balancing multiple app servers (using perlbal, etc), a dedicated media server, etc...see these for more details (deployment guide, performance tips)

good luck...

like image 157
Ben ODay Avatar answered Feb 05 '23 14:02

Ben ODay


Now what?

Deploy. If you have an MVP that is.

Other thoughts:

  1. You didn't mention anything about testing. Do you have unit tests? Do you feel that the test coverage is adequate? I'd recommend reading Karen M. Tracey's book Django 1.1 Testing and Debugging.
  2. Have you watched Jacob Kaplan-Moss's Deployment Workshop?
  3. Have you done any usability testing? You can check out Joel Test article by Joel Spolsky, or you can read Rocket Surgery Made Easy or Don't Make Me Think both by Steve Krug.
  4. Speaking of Spolsky, how does your process rank on the Joel Test?

I know that your question was slanted toward performance, and it may seem that my thoughts aren't performance related. However, thinking about some of these seemingly unrelated items may lead you in a direction that will impact performance. For instance, usability testing may reveal that a certain feature could be reduced in scope yielding better performance due to less data being delivered to the end-user.

like image 38
Matthew Rankin Avatar answered Feb 05 '23 16:02

Matthew Rankin