spyce
home
license
community
download
examples
resources
wishlist
contrib (@sf)
documentation
intro
lang
runtime
modules
tags
install
exits
sourceforge
statistics
freshmeat

Documentation - Performance
[[ Spyce ]]
Python Server Pages
by Rimon Barr

Prev: 7 - Addenda Up: 7 - Addenda Next: 7.2 - History

7.1. Performance

Although flexibility usually outweighs raw performance in the choice of technology, it is nice to know that the technology that you have chosen is not a resource hog, and can scale to large production sites. The current Spyce implementation is comparable to its cousin technologies: JSP, PHP and ASP. We ran a micro-benchmark using hello.spy and equivalents. All benchmark files are available in the misc/benchmark directory.

examples/hello.spy
<html><body>
  Hello [[print 'world!',]]
  [[ for i in range(10): { ]]
    [[=i]]
  [[ } ]]
</body></html>
Run this code.
(requires Spyce-enabled web server)

Spyce was measured under CGI, FCGI, mod_python and proxy configurations. For calibration the static HTML, CGI-C, CGI-Python and FCGI-Python tests were performed. In the case of CGI-C, the request is handled by a compiled C program with the appropriate printf statements. In the case of CGI-Python, we have an executable Python script with the appropriate print statements. FCGI-Python is a similar script that is FCGI enabled. ASP was measured on a different machine, only to satisfy curiosity; those results are omitted.

Configuration Hello world!
Spyce-modpython 250
modpython publisher 300
Spyce-proxy 200
JSP 100
PHP 450
Spyce-FCGI 100
Python-FCGI 140
Spyce-CGI 8
Python-CGI 25
C-CGI 180
Static HTML 1500

The throughput results (shown above in requests per second) were measured on a Intel PIII 700MHz, with 128 MB of RAM and a 512 KB cache running RedHat Linux 7.2 (2.4.7-10 kernel), Apache 1.3.22 and Python 2.2 using loopback (http://localhost/...) requests. Since each of the script languages requires an initial compilation phase (of which JSP seems the longest), the server was warmed up with 100 requests before executing 1000 measured requests with a concurrency level of 3, using the ab (Apache benchmark) tool. Figures are rounded to the nearest 25 requests/second.

Conclusion: Both the mod_python and FCGI version can handle large websites, as the Spyce engine and cache persist between requests. The CGI version takes a hit in recompiling Spyce files on every request. This may be alleviated using a disk-based Spyce cache (as opposed to the current memory-based implementation).


Prev: 7 - Addenda Up: 7 - Addenda Next: 7.2 - History


© 2002-08 Rimon Barr
email: rimon@acm.org
Spyce Powered SourceForge Logo [[ Spyce ]]
Python Server Pages
version 1.3.13