Tuesday 13 June 2006 — This is 17 years old. Be careful.
Peter Thomas gives us the full picture of a Java web application call stack. It’s very impressive. It shows about 100 call frames, annotated with the different layers of the architecture. The comments there debate the question of whether this is a good thing or a bad thing.
I was curious about the equivalent stack for our current mod_python/Django/MySQL architecture. I won’t paste the actual stack trace here (opinions differ about the extent to which work details can be discussed in a blog), but here’s the breakdown by layer:
- mod_python: 1 stack frame
- Django’s mod_python support: 3 stack frames
- Our view infrastructure: 3 stack frames
- Our business logic: 3 stack frames
- Django’s ORM: 4 stack frames
- Django’s MySQL support: 2 stack frames
- MySQL’s Python layer: 3 stack frames
for a grand total of 19 Python stack frames between Apache and MySQL, six of which are our code. I won’t claim to know whether this is better or worse, just comparing.
I've been learning Django recently, and I keep noting how it does so much, but feels so nice and light. It's even easy to jump in and inspect the core Django code.
Another important thing to point out is that *every single level* in the Django call stack is free and open source. We have the right to fix any problem at any layer. The fact that there aren't that many of those layers means that finding and fixing bugs actually is a possibility, too.
*There's* your business case for open source :)
By the way -- what tool did you use to see Django's call stack? I've been fooling with trace.py but I can't get it to do the right thing...
Of course you can argue that each call is also more productive as well, but since it's only a single data point it's probably best not to worry too much about exact numbers!
Also Python code is pretty bare-metal, so that file.write or socket.write go to the syscall immediately. Try that in Java and you'll find 30 layers of complex abstractions for doubtful benefits and obvious slowness.
Sure, but they'll fix that in Python 3000 ;-)
Add a comment: