The PHP4 java extension has problems when running inside a threaded 
webserver.  
http://bugs.php.net/bug.php?id=16690

This is due to the fact that the JavaVM pointer was a Thread Safe
Resorce Manager Global (TSRMG).  This pointer is meant to be shared
by all threads, and so should be a real global.  The other java TSRM
globals are correct as each thread will get it's own JNIEnv from the
JavaVM.  Credit goes to Momchil Georgiev for figuring this out.  

My CVS account doesn't appear to have write access, so here are where
the patch and new java.c can be found:

http://tjw.org/php_java/java.c.thread_patch
http://tjw.org/php_java/java.c

I tested this on Apache 2.0 (with MPM worker) on Linux only.  It should
be noted that running the PHP Java extension from inside of a threaded
webserver gives a HUGE performance benefit.  This is becasuse in non-threaded
webservers (e.g. Apache 1.3) each child process spawns its own completely
seperate JVM instead of just having one shared JVM .  In my simple testing
running siege to compare Apache 1.3 and 2.0 (with threads), the threaded 
webserver produced a 0.3 load average while apache 1.3 produced a 30.0 
load average.  I was running 'siege -n 30 -i' on Example 1 from the
PHP manual page for the java extenstion.

-Tony

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to