From: Kevin B. <kb...@ca...> - 2002-02-18 19:47:56
|
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. 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). You could also use one of the somewhat-standard CGI-improvements (persistent CGI, etc.), or you can roll something on your own with some sort of RPC mechanism to talk to your long-running Java process (a CORBA link, a custom socket protocol, etc.). kb |