Java and PHP bridging
The__ Pressflow project is currently evaluating methods to offload performance-critical code to Java (or another high-performance, compiled language).
Tomcat to PHP
- Java servlet with PHP inside (no calls from PHP to Java)
- RHEL 5 + Tomcat 5.5 + PHP 5.2.11 with APC over FastCGI
- ~40ms overhead for each Java-to-PHP request
- This configuration is useless. The best way to deliver PHP pages directly remains Apache + mod_php.
JSP to PHP
- Java servlet with PHP inside (no calls from PHP to Java)
- RHEL 5 + Tomcat 5.5 + PHP 5.2.11 with APC over FastCGI
- No significant performance difference between serving request directly with Tomcat and PHP versus using a JSP wrapper
- A JSP wrapper provides no clean mechanism for PHP to send headers.
- Serving a page purely from JSP scaled extremely well. There is potential for this configuration to handle some requests without connecting to PHP.
Tomcat to PHP and back
- Java servlet with PHP inside (with calls from PHP to Java)
- RHEL 5 + Tomcat 5.5 + PHP 5.2.11 with APC over FastCGI
- Same Java-to-PHP performance as first configuration
- PHP-to-Java requests take ~1-3ms
- Have not measured the overhead of including the PHP-to-Java bridge code
- This configuration is useless. The best way to deliver PHP pages directly remains Apache + mod_php.
JSP to PHP and back
- Java servlet with PHP inside (with calls from PHP to Java)
- RHEL 5 + Tomcat 5.5 + PHP 5.2.11 with APC over FastCGI
- Same Java-to-PHP performance as first configuration
- PHP-to-Java requests take ~1-3ms
- Have not measured the overhead of including the PHP-to-Java bridge code
Apache mod_php to Java
- Apache with mod_php (with calls from PHP to Java)
- RHEL 5 + Apache 2.2 + PHP 5.2.11 with APC over mod_php + Tomcat 5.5
- HTTP client to PHP requests have < 2ms overhead
- Loading the PHP-to-Java bridge takes 10-11ms
- PHP-to-Java requests take ~1-3ms
- Best configuration yet, but no potential to serve requests purely from Java.
Java to Quercus PHP to Java
- RHEL 5 + Tomcat 5.5 + PHP via Quercus
- Not tested yet
- Should eliminate Java to PHP overhead
- Caucho promises equivalent performance to PHP + APC with even their GPL version.
- Only the proprietary version of Quercus supports compiling PHP.
The Zend Java bridge
- Proprietary only
- Untested
IBM Project Zero/WebSphere sMash
- Not claimed to be production-ready