Please subscribe to RSS Feed! :)

Ian wished for loop syntax examples in the Templating Engine Cookoff, so I just added them.
And none of you Django programmers have given me code to include Django templates in the cookoff. You can't throw an exception in this town without hitting a Django programmer, so what's up? C'mon, it's easy - I just need something analogous to this:
The answer to the Ultimate
Question is ${everything['universe'].answer}.
Among our weapons are:
% for weapon in weapons:
${weapon}
% endfor
import mako
import mako.template
class MakoDemo(Demo):
name = 'mako'
version = mako.__version__
def demo(self, vars):
self.template_name = 'mako.txt'
template = mako.template.Template(filename=self.template_name)
return template.render(**vars)

One of the perennial problems I've had with using Django as the basis of my site is speed. At first, I used Apache and mod_python to serve the Django views, but once I realised how slow that was I switched over to using mod_wsgi for Django, whilst having the static files served by lighttpd. Apache is just basically the broker that sends the requests in the necessary directions.
But things are still slow, especially since I updated the site to its latest incarnation. I'm used to dealing with performance issues in web apps, so I'm sure I'll nail this one sooner or later, but it's still annoying.
So, dear lazyweb, cast your weather eye over this setup and make any suggestions for improvements as appropriate:
ab gives me the following statistics over 1000 requests (non-concurrent):
Server Software: Apache/2.2.8
Server Hostname: grahambinns.com
Server Port: 80
Document Path: /blog/
Document Length: 39362 bytes
Concurrency Level: 1
Time taken for tests: 474.210 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 39898000 bytes
HTML transferred: 39362000 bytes
Requests per second: 2.11 [#/sec] (mean)
Time per request: 474.210 [ms] (mean)
Time per request: 474.210 [ms] (mean, across all concurrent requests)
Transfer rate: 82.16 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 56 59 3.3 58 87
Processing: 278 415 100.7 376 875
Waiting: 74 127 30.3 116 377
Total: 337 474 100.9 437 941
Percentage of the requests served within a certain time (ms)
50% 437
66% 544
75% 558
80% 574
90% 601
95% 621
98% 646
99% 689
100% 941 (longest request)Suggestions in a comment or by email to blog@grahambinns.com. Thanks in advance, folks...
Categories: dear lazyweb django performance planet ubuntu uk