Hi Alan

>It's very difficult to tell what might be the cause of these timing
>differences without knowing what code is running.
The code is simple, downloading a pdf file on n pages, add a watermark to it and send it back.

>How are you running the code inside Tomcat? Are you using modjy, the
>WSGI gateway? Or are you running a servlet written in jython?
I am running the code inside a jython servlet like this simple example:
http://mlboost.svn.sourceforge.net/viewvc/mlboost/jython/HelloWorld/HelloWorld.py?view=markup

python and jython graph use the exact same code. I have integrated the service inside wsgiref.simple_server (http://docs.python.org/library/wsgiref.html)

To get the time, I wrote a simple python script using time.time that calls each servers (jython/pthon/tomcat) sequentially and store the results (a simple wget).

Does that help? Write now, I don't have any real hypothesis to try to validate except that servlet may re-compile to bytecode all python code at each calls, only profiling could give me hints but I rather do a theoretical analysis first before jumping there. 

Thanks,
Francis
http://fraka6.blogspot.com
2010/1/25 Alan Kennedy <jython-dev@xhaus.com>
[Francis]
> I have integrate a jython2.5.1 service inside a java servlet (tomcat) and
> compared the performance to a std wsgi server.
> Take a look at this graph:  (same service)
> http://4.bp.blogspot.com/_-qQ8PeHP82w/S1vUL_XTc-I/AAAAAAAAAGw/Ledt-wYrx2c/s1600-h/jython_python_tomcat_20.png
>
> Any idea why I get so bad performance? Is there a settings I should set? Is
> this a cachedir issue?
> I am not sure what to look at to get acceptable performances.
>
> Thanks,
> http://fraka6.blogspot.com/2010/01/power-of-python-within-tomcat-for.html

It's very difficult to tell what might be the cause of these timing
differences without knowing what code is running.

How are you running the code inside Tomcat? Are you using modjy, the
WSGI gateway? Or are you running a servlet written in jython?

For the curve labelled "jython" in your graph, what WSGI server are
you using for that? Did you use the same WSGI server for your cpython
timings?

Alan.



--
Francis Piéraut, eng. M.A.Sc.
Senior Software engineer/Machine Learning Consultant
http://francispieraut.com/