Navigation

RSS 2.0 New Entries Syndication Feed Atom 0.3 New Entries Syndication Feed

Show blog menu v

 

General

Use it

Documentation

Support

Sibling projects

RIFE powered

Valid XHTML 1.0 Transitional

Valid CSS!

Blogs : Archives

< Frank Sommers : What Do You Look For in a Template Engine?   Artima article : Distributed Web Continuations with RIFE and Terracotta >
Clustered Drupal through Quercus, Terracotta and Ehcache

Caucho created an impressive Java implementation of PHP that runs in Resin, called Quercus.

I regularly hear people complain about the scalability of Drupal on PHP and after looking at the layer cache implementation, it seems that they use the database as a cache. This is understandable since short of using memcached, PHP doesn't support preserving object state across requests. However, tunneling everything through the database is bound to create a bottleneck.

Quercus has a neat module system that allows the creation of PHP functions in Java. So I wondered if I could use Terracotta together with Ehcache to replace Drupal's caching system with a more scalable solution.

After some tinkering and experimenting I got it to work. I did have to resort to some ugly hacks, since Terracotta doesn't officially support Resin yet (they inject their own system classloader which doesn't play well with how we do stuff). I also didn't do any performance tests, nor went through all the Drupal features to check if everything still worked.

I think this prototype is very interesting though, since it gives a glimpse of what is possible nowadays in the Java world when creating 'technology mash-ups' (for the lack up a better term). Who would have thought a year ago that you would be able to improve the scalability of a PHP CMS by using JVM-level clustering, makes my mind spin if I think about it.

If you want to try this out for yourself, I posted detailed instructions on our wiki. I'm interested in knowing what your findings are and if you have any improvements to what I did, please reach out and let me know.

posted by Geert Bevin in Terracotta on Aug 1, 2007 2:54 PM : 16 comments [permalink]
 

Comments

Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Very interesting. Drupal definitely needs help scaling. Productize that and show it scales and it could be popular.
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
You can use quercus in your preferred servlet container if you have problems with resin (quercus.war file is available as separate download, and you can take the updated jars from the latest resing snapshot as the standalone quercus is a bit outdated).

Unfortunately it will only run in interpreted mode if used outside "resin pro".
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
I tried running Quercus on Tomcat, but there were problems with getting the PostgreSQL database connectivity to work. I couldn't find any logs giving me more information, so I didn't bother to delve deeper. I might debug is more extensively later on though. Seems to be an even nicer value proposition to be able to not enforce resin as a servlet container.
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
I run it in tomcat but against mysql: I simply added the connector/j drivers in the common/lib (and maybe the catalina.jar in shared/lib). Then I add this to the tomcatplugin (in eclipse):

<Resource 
  name="jdbc/drupal"
  auth="Container"
  type="javax.sql.DataSource"
  username="root"
  password=""
  driverClassName="com.mysql.jdbc.Driver"
  url="jdbc:mysql: / / localhost / ? socketFactory=socketFactory=com.mysql.management.driverlaunched.ServerLauncherSocketFactory"
  maxActive="8" 
  maxIdle="4"/>


This way I run the embedded version of mysql, but in the same way you can also use the standard mysql.

Tomcat+eclipse+tomcatplugin+quercus+embeddedmysql is really a great way to have the whole developer environment ready to use everywhere without the need to install anything.
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
What a great feat :-) Very impressive.

Peace
-stephan

--
Stephan Schmidt :: stephan@reposita.org
Reposita Open Source - Monitor your software development
http://www.reposita.org
Blog at http://stephan.reposita.org - No signal. No noise.
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Hi,

Had you considered using Zend's distributed cache? I know it costs a bit, but it would leave you with fewer moving parts.

(BTW I'm not saying I don't like how you've tackled it, in fact I love it)

cheers,

~luke
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Hi Luke,

I didn't look into Zend's distributed cache. I mainly looked into this since I work at Terracotta and heard about the scalability problems of Drupal. I thought it would be really cool if I could apply our product to a PHP problem.

Take care,

Geert
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Hi,

I don't really get why Terracotta was used since Ehcache supports distributed caching out of the box.
Or was the distributed cache in Ehcache not used?
Or does Terracotta play a role that I'm not aware of?

I was not previously aware of the existence of Quercus. Now I have reason to consider using PHP :-).

-ted
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Quercus runs fine in GlassFish v2 (and v3 actually).
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
The reason why Terracotta is interesting here is that the objects in the cache don't have to be serializable to be clustered. This makes it totally appropriate to apply to systems that weren't designed with clustering in mind. Also, the persistance is very optimized and you can essentially take down your entire cluster if you want, start up any number of other nodes again, and only the cache items that are needed will be pulled in from the Terracotta server by those nodes.
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Interesting article and comments too.
It first time that I heard about this combination. Tomcat + PHP + Terracotta....
Maybe this will help us to create and finish better and faster projects.
8)
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
>PHP doesn't support preserving object state across requests

Funny, I've just been looking at an open source PHP project which does exactly that (dutchpipe.org)
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Does Drupal really NEED to run on a cluster? most blogs are quite small, there is not need to run as Enterprise application, but Great to know, It can run on a cluster, just incase someone's blog got really really popular.
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
=):D8)
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
Superb feature, very impressive. :D
Re: Clustered Drupal through Quercus, Terracotta and Ehcache
my mysql Quercus config did not work.

Add a new comment

Comments on this blog entry have been closed.

< Frank Sommers : What Do You Look For in a Template Engine?   Artima article : Distributed Web Continuations with RIFE and Terracotta >
 
 
 
Google
rifers.org web