[mod_python] Performance Problem

Orr, Steve sorr at rightnow.com
Tue Aug 23 14:40:28 EDT 2005

Well obviously mod_python is performing well and I doubt anything
connected with Linux versions would account for that much difference so
the thing to focus on would be tuning dbxml or the code associated with
it. Don't you have a way to run/test chunks of code outside of a web

-----Original Message-----
From: M Chaudhary [mailto:igp-dev at infogridpacific.com] 
Sent: Tuesday, August 23, 2005 12:13 AM
To: mod_python at modpython.org
Cc: Orr, Steve; IGP; and at doxdesk.com; xml at sleepycat.com
Subject: Re: [mod_python] Performance Problem

Hello Orr, Steve ,
        As you told i tested my application using "ab" tool for three 
cases (each for single request and 5 concurrent requests ):-
and the results were as follows (the following log was generated from my

mod-python handler itself using time.time() method ) ----
Attached is the test module . Please check it and view the following 
# Test 1 -- dbxml :- get a document and write it to browser
0.00605797767639 # single request
0.00417685508728 # 5 concurrent requests
# Test 2 -- pxtl :- pxtl process a File and write it to browser
1.65334200859 # single request
0.428733825684 # 5 concurrent requests
# Test 3 -- pxtl  and dbxml :- get a document from dbxml container ,pxtl

process it and write it to browser
3.01918792725 # single request
15.9680738449   # 5 concurrent requests

As you can see the first problem is that when i test it for 5 concurrent

request i get 9 entries in my log file
each in each case.
And the second but most annoying problem is for Test 3 ( for both pxtl 
and dbxml ) it takes more than 10 seconds
to satisfy each request .
Even i tested my application on Upgraded Kernel (2.6.9-11.EL).
Should i use any other Linux distribution.
Can you tell me what the problem may be ? And what should i do ?

Ajinkya N

Orr, Steve wrote:

>I can't see that mod_python would be the problem. For a given request,
>what percentage of the overall response time is involved with database
>access versus code execution? You need to know that. I'd first try
>tuning the code before doing any web stuff. Especially tune the
>queries and the network access to the database before going through the
>web server. Then setup database connection pooling so each page request
>reuses a connection instead of establishing a new connection with each
>page turn. Can you do some kind of session management to avoid
>"the container" with each page turn?
>Using ab I did some bench marking a year ago and with an old, cheap
>2GHz PC with 512M RAM as the web server I was able to get 750 page
>per second. The database was Oracle and I used the connection pooling
>feature that comes with cx_Oracle on the OCI. (A persistent connection
>can be established for each Apache process so this isn't really
>necessary.) I also reused cursors to avoid the parsing overhead.
>(Besides doing web development I'm a DBA dweeb.) Without mod_python and
>connection pooling it got as slow as 11 requests per second. Of course
>my benchmarking was doing simple stuff but I was satisfied that
>Apache/mod_python would perform well and I wouldn't have to go down a
>"Twisted" path. Don't know anything about dbxml but you should address
>the architecture/code first. If performance is really a big issue then
>consider load balanced web servers and a good disk array setup on the
>Steve Orr
>-----Original Message-----
>From: mod_python-bounces at modpython.org
>[mailto:mod_python-bounces at modpython.org] On Behalf Of IGP
>Sent: Wednesday, August 17, 2005 11:01 PM
>To: xml at sleepycat.com; mod_python at modpython.org
>Subject: [mod_python] Performance Problem
>I am accessing dbxml via my mod-python handler.
>The dbxml manager instance is created  , the container is opened and
>required operation
>is performed(querying , geting a document ) for each client request . 
>This is affecting the
>performance . Is there any way to enhance the performance ? I mean that

>the XmlManager instance
>will be created only once , the container will be opened and the stored

>in memory , so that the
>response time will decrease .
>I am using following versions of software
>1) dbxml -  2.1.8
>2) python - 2.3.4
>3) mod-python - 1.3.4
>4) apache 2.0.52
>5) Kernel version-2.6.9-5.0.5-EL
>Please do reply if you know the solution .
>Thanks in Advance,
>Mod_python mailing list
>Mod_python at modpython.org
>Mod_python mailing list
>Mod_python at modpython.org

More information about the Mod_python mailing list