Join us for the Honeynet Workshop 2024: May 27th–29th, Copenhagen, Denmark

Iteolih: Python Benchmark

24 May 2009 Markus Koetter iteolih python

As the plan is to embedd python as scripting language into the honeypot, I ran a benchmark on a testsuite. The ’testsuite’ is a c core which accepts connections, and allows python to deal with the input. The protocol used for benchmarking is http, the service serves a non static html page.

I tested

    • 2.6.2_(release26-maint,_Apr_19_2009,_02:15:38)
    • 3.0.1+_(r301:69556,_Apr_15_2009,_17:22:45)_
    • 3.1a1+_(py3k,_Mar_30_2009,_02:02:26)_

To benchmark, I ran the apache benchmark tool ab

ab -n 100000 -c 15 http://localhost:8080/bar

The result:

Python 3.0.1 serves about 978 requests per second, where Python 2.6.2 does 3512 requests/second.

Obviously Python 3.0 does something wrong, talking about factor 4x, it is noticeably slower. But I’m  glad to see it is fixed in 3.1 already.

I tried to benchmark using unladen-swallow, the llvm based python project run by google, but was not able to link the code properly. (undefined symbol: _ZTIN4llvm14ModuleProviderE)

As Python 3.1a is almost as fast as 2.6 for our needs, and it can be tricky to port python 2.6 code to 3.x, we will use python 3 as embedded scripting language.