Home

Sat, Dec. 31st, 2005, 02:13 pm
Axiom performances

Axiom is a Divmod product that build the link between you python (twisted) programs and you SQLite DB.

Here after some "stress tests" of Axiom within a simple wiki twisted+Nevow application I've made (wiki.tgz).

Configuration:python-2.4.2, Twisted-2.1, Nevow-0.7.0, Axiom-0.4.0, pysqlite-2.0.4, sqlite-3.2.1 on "Linux gentoo 2.4.26 #2 SMP Fri Jun 25 21:32:12 CEST 2004 i686 AMD Athlon(tm) XP 2000+ AuthenticAMD GNU/Linux"

  • 100000 insert within (sec):68.878923893. (within 1 transaction). Quite amazing. I would just mention that during this insert the memory used by the python process increases and goes up to 160MB!!!.
  • nice -n 20 ab2 -n1000 -c100 is not impacted by the DB size, and the result is 38#/sec with or without an empty DB. Here the twisted process does not eat more than 14.3MB and stays stable.
  • Because ab is always requesting the same URL, I've written testor.py (loop that use urllib2.urlopen) that will request 1000 different URLs. During this test the memory consumption stays stable to 14.4MB. Very good!!!!. Just for information, this test gives: " 1000 different http requests in 29.004860878 sec Min: 0.0249710083008, Max: 0.10649895668 "
My personnal conclusions:
  • Twisted+Nevow+Axiom resist very well to a massive load of 100 concurrent requests
  • Despite Axiom is not a ORM like SQLObject, Axiom is a good solution to interact with SQLite. I've tested it on Gentoo and Windows.
  • Axiom interact only with SQLite. I would really like to see Axiom interfacing with other DB like postgresql. I think that Divmod developers would like too, but don't have the time right now to do it. Any volunteers ?

Appendix: With 100000 different records within the DB

This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:        TwistedWeb/2.1.0
Server Hostname:        localhost
Server Port:            8080

Document Path:          /Front
Document Length:        507 bytes

Concurrency Level:      100
Time taken for tests:   26.300422 seconds
Complete requests:      1000
Failed requests:        1
   (Connect: 0, Length: 1, Exceptions: 0)
Write errors:           0
Total transferred:      629001 bytes
HTML transferred:       507001 bytes
Requests per second:    38.02 [#/sec] (mean)
Time per request:       2630.042 [ms] (mean)
Time per request:       26.300 [ms] (mean, across all concurrent requests)
Transfer rate:          23.35 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  423 1082.7      2    9035
Processing:    31 2022 856.7   1818   10726
Waiting:        4 2018 857.5   1816   10726
Total:         64 2445 1431.7   1999   10728

Percentage of the requests served within a certain time (ms)
  50%   1999
  66%   2480
  75%   2553
  80%   2687
  90%   4640
  95%   4918
  98%   8667
  99%   8667
 100%  10728 (longest request)

Appendix: With a empty SQLite-3.2.1 DB

This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:        TwistedWeb/2.1.0
Server Hostname:        localhost
Server Port:            8080

Document Path:          /Front
Document Length:        507 bytes

Concurrency Level:      100
Time taken for tests:   25.458599 seconds
Complete requests:      1000
Failed requests:        1
   (Connect: 0, Length: 1, Exceptions: 0)
Write errors:           0
Total transferred:      632146 bytes
HTML transferred:       509536 bytes
Requests per second:    39.28 [#/sec] (mean)
Time per request:       2545.860 [ms] (mean)
Time per request:       25.459 [ms] (mean, across all concurrent requests)
Transfer rate:          24.24 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  447 1258.4      2    9046
Processing:    58 1990 604.3   2071    5247
Waiting:       32 1984 600.7   2068    5246
Total:        120 2438 1433.2   2140   10190

Percentage of the requests served within a certain time (ms)
  50%   2140
  66%   2564
  75%   2572
  80%   2609
  90%   4497
  95%   5636
  98%   6097
  99%   6097
 100%  10190 (longest request)

Fri, Dec. 30th, 2005, 01:28 pm
Python webframeworks: applications I've investigated

Since several years I'm spending time to evaluate, test and plays with some of the different python web-frameworks.

If I remember well, the list could be like (in chronological sequence):
- Draco: .
This was based on mod_python. That was my first, and not good, experience with mod_python.
In fact, the possibilities to migrate from one "test server" to a "production server" is not that trivial with mod_python and apache.
I've got other issues with the DB connection, mainly because of the apache threads.

- Snakelets: http://snakelets.sourceforge.net.
Very simple and very nice python solution. You can build very quickly simple web site.
Irmen (the Project leader) has made a Blog (called frog) on top of Snakelets which shows you well how simple it is with Snakelets.
Snakelets is 100% python, thus you can run everywhere.
Very good to learn the basics of an VC (from MVC) web application.

- Zwook: http://www.zwook.org.
This was my first experience within the Zope world. Zwook (only in french) use, and abuse ;-), the Zope functionalities: heritage, ... .
Zwook, turns your web site into a components building blocks. If you can build nice constructions with Lego, you would create nice web site with Zwook.
My main issue was that the developer community is not structured at all (lot of different Zwook kernel), and that they only speak french.

- Quixote: http://www.mems-exchange.org/software/quixote/
Very flexible and very nice web-tool. You must plug it in a standard webserver (twisted, medusa, cherrypy, mod_python, ...).
If fact, Quixote build the link between the URL and the different python objects, manage sessions, ...
PTL is not really my cup of tea, and I prefer Cheetah.
Quixote has several "production" website, the most known is LWN (http://lwn.net)

- Cherrypy: http://www.cherrypy.org
A very simple threaded web server where every Object's methods become web pages. The user community is quite active and the plugin mechanism is very powerful and easy to use.
I see lot of similitude between Cherrypy and Quixote, but Cherrypy propose (and force you) to use their own thread web server.

- Turbogears: http://www.turbogears.org.
Who has not heard about Turbogears ???
Turbogears is a bundle of Cherrypy, Kid, SQLObject, Mochikit (at least at the beginning).
They want to become the Ruby on Rails for the Python's developers.
To have my own idea, I've developed "ProjectsMgt" (http://projectsmgt.opensource4you.org).
Turbogears 0.8 is not as fun as you could imagine, but 0.9 (still in development) will comes with lot of new features. Then Turbogears will start to be quite interesting.
Turbogears comes with tools like Mochikit that allows you to exchange data easily between your Javascript and your server.
It's quite nice, but if it's what you are looking for, Nevow is much better.

- Nevow: http://nevow.org
The most interesting part of Nevow is his tide integration with the Browser. Nevow integrate the concept of XMLHttpRequest since the beginning (before the AJAX's wave).
That's where I am today.
Nevow use a template which is very close to Kid (I should have to say the opposite).
By goolging bit, I've found a SQLObject like for Twisted (Tada).
What's amaze me is that you have all you need within Twisted+Nevow+Tada. This solution would allow you to make real MVC applications where the Javascripts running
on the browser and the python's objects running on the server can really communicate (not just exchange data).

That's it!!!
Now, you know where I'm spending my hobby time ;-).

William