Archives for the 'Tips' category
Tips to keep your Django/mod_python memory usage down
Updated May 31 at 08:05 CDT (first posted May 30 at 09:57 CDT) by Remi in Django, Memory, Tips - 9 comment(s)
Most people manage to run their Django site on mod_python within the memory limits of their "Shared 1" or "Shared 2" plans but a few people are struggling to stay within the limits.
So here are a few tips that you can use to try and keep your memory usage down when using Django on mod_python:
Read the full article and comments
Handling the Digg effect on a standard shared hosting account
Updated Sep 9 at 05:26 CDT (first posted Aug 14 at 05:04 CDT) by Remi in General, Shared, Tips - 0 comment(s)
I've written before about how we handled the Slashdot and Digg effects on our main website and blog (serving tens of thousands of 10-40MB videos). I explained how we load-balanced our blog on multiple servers, but this article is about handling the Digg effect on one of our standard shared hosting accounts.
Last Friday, a nice article from Amir Salihefendic landed on the front page of Digg and got over 800 diggs !
This generated a pretty big amount of traffic on Amir's site but the site stayed responsive at all time, the load remained low on the server and the other sites on the server weren't impacted at all.
Amir has a standard Shared 2 account with us (in fact, his site is on "Viper", one of our oldest servers) and his site uses mod_python.
This confirmed what we've thought for a long time: Apache rocks, provided you use the following simple tips:
- Use "Timeout 30" and "KeepAliveTimeout 3" (or similar values): this will insure that no client will block Apache's threads or processes for too long (otherwise the number of Apache threads/processes will skyrocket). If you're hosting with us, these values are set by default in our main Apache server for you.
- Serve as much content as possible statically: even if you use a dynamic framework such as Rails, Django, TurboGears or mod_python, you should try to serve your static data (images, stylesheets, ...) statically (ie: serve them from your web server directly and save your dynamic framework from having to serve all these extra little requests). Our control panel makes it easy for you to configure that.
- Use caching for expensive tasks: if parts of your pages are expensive to build (for instance, they require multiple DB queries), try to cache the result (either the HTML itself or just the result of the DB queries) to avoid having to rebuild it every time.
Read the full article and comments
Staying cool when digged and slashdotted
Updated Dec 28 at 11:11 CDT (first posted Jul 6 at 11:19 CDT) by Remi in General, Tips - 1 comment(s)
Two weeks ago our control panel demo landed on the front page of Digg and two days ago it landed on the front page of Slashdot.
This generated quite a bit of traffic but our site and blog stayed just as fast. I thought I'd shared a few tips on how we achieved this.
Read the full article and comments