From: Niko S. <nik...@us...> - 2002-02-19 08:51:22
|
james p wrote: > We have a bunch of Python (cgi) scripts producing html > behind an Apache web > server. We also have a set of Java libraries that I > want to access from > these Python scripts, but I haven't been able to > figure out how to do this. > I have downloaded and tried out Jython, but it takes > 5-6 seconds just to run > a one-line 'print "hi"' script, and this is, of > course, not acceptable for a > web server. Kevin Butler wrote: > 5-6 seconds seems high - unless you're running on slow hardware > or jython can't access its package cache, it should be more > like 2.5 seconds. > > Which is probably still not acceptable. :-) > > Your best bet if you want to use Java in a web server environment > is to have a persistent Java process, so you don't pay the JVM > startup > time with every hit. If you really need to access > Java libraries in servicing web requests, you should consider > converting > the relevant CGI scripts to servlets (which you can code in > Jython). If you are using Jython in version >= 2.1 alpha, there comes servlet support for free (org.python.util.PyServlet), you find a detailed description how to use this environment from within your servlet container (for example Tomcat) at: http://jywiki.sourceforge.net/index.php?JythonServlet Hope this helps, Niko |