Tags: Java
On Javalobby Michael Urban asks Java: One Platform To Rule Them All? noting an article, Use Java to Improve Drupal's Scalability. In that article an exploration of running Drupal on the Java platform is done, and he is looking for greater scalability than the regular PHP platform offers. Drupal is a "content management system" written in PHP, and I happen to use Drupal as the basis for some web sites that I run.
So, hmm, PHP. Isn't PHP in competition with Java? Well, so is/was Ruby, right? But as JRuby is exemplifying the ability to run multiple languages on the JVM, it's worthwhile to consider the benefits of recasting even more languages so they run on the JVM. And, to be real, running multiple languages on the JVM is not new at all. What's new is that we (the Java team) are being more open and supporting of this concept. scripting.dev.java.net
has information on the multiple languages that run on the JVM.
First, why? The JVM, and the overall Java ecosystem, offers an interesting facility to language authors. The community developing a language has to develop the grammar of their language, code generation, code execution, and useful libraries to facilitate writing applications in that language. The JVM offers a preexisting platform for code execution, that's cross platform, and (now that the OpenJDK project exists) offers the potential of ubiquity. The Java ecosystem is rich with libraries and facilities. And we have over 12 yrs of refinement and optimization of the JVM, both inside and outside Sun, with a wide array of system optimization tools, etc.
For example.. One of the key limitations in Drupal (and other PHP based webapps) is it runs best on top of MySQL. So, sure, MySQL is pretty darn popular but it's by far not the only database out there. Perhaps another database would offer some additional capabilities or scalability. In PHP cross-database support is pretty weak, compared to the rich array of cross-database capabilities offered by the Java ecosystem. If Drupal were implemented knowing PHP could access backend Java-implemented libraries for cross-database support, would make available EJB or Hibernate or the variety of other technologies developed to support enterprise application development. The Drupal developers could continue using their familiar PHP, but have access to very capable backend facilities.
Another key limitation in Drupal is image handling. Like with many other PHP webapps, to handle images Drupal depends on external apps like ImageMagick being installed on the server. The image handling includes autoresizing or watermarking. If Drupal were implemented knowing PHP could access Java facilities, it could simply use Java2D functions to do whatever image manipulation they want, with no dependency on an external tool. Java2D can operate on headless servers (using the Headless AWT toolkit) and operate on offscreen images.
In Geert Bevin's article he discusses using Terracotta to provide system performance improvements. The Java ecosystem includes a wide variety of enterprise-quality solutions scaling webapps, including Terracotta.
At the moment the possibilities for executing PHP on top of the JVM include:
- PHP (
www.caucho.com/resin-3.0/quercus/
) - pure Java implementation of PHP. The Resin appserver has this bundled - PHP (
php-java-bridge.sourceforge.net/
) - uses native PHP implementation through remoting.
Source: weblogs.java.net