Posted by bnewport
on June 28, 2006 at 11:47 AM PDT
I've been building a PHP site over the past 6 months and it's been interesting given my Java background.
We started building http://www.trackpedia.com at the beginning of January this year. We initially knocked it together using mediawiki and vbulletin. It was very easy to do this. We had to do a little patching to make mediawiki use vbulletin for users and then add some extensions to mediawiki for googlemaps and some other stuff but overall very easy.
Hosting it was a piece of cake and we pay under 10 bucks a month for this. Performance wise, it looks fine. A lot of mysql statements generate each page but it's plenty fast enough.
If I had to do it in Java then I've a feeling, things would be more difficult. First, cheap hosting is hard although that seems to be getting better but there still isn't the competitive marketplace as their is in PHP land to really drive down cost.
According to the stats on our site, we are allocated 40MB of memory tops. It's piddly compared with what you're typical J2EE app takes. For hosters this must be a big advantage.
Then there is the fact that it launches a PHP interpreter for every page request and this isn't so expensive. If I tried to launch a JSP interpreter well, we'd be looking at 30 second response times easy.
I've had problems with JVM start up times before when using JMX with WebSphere. We provide a way for an external cluster infrastructure to push activate/deactive resource events using JMX to a WebSphere JVM. This lets them use our hot recovery stuff in 6.0. Unfortunately, it takes over a minute and a ton of CPU just to start a JVM with jython and a JMX client to send this simple command. 60 seconds is a long time. We ended up using a servlet as a script target and then use curl or a similar utility to send a HTTP request with the command to the servlet. Much, much faster and this is what we recommend right now.
I guess PHP has the advantage that it's just a text file where as most Java classes have extensive dependency requirements and drag in a lot of classes which slows down execution. None of that in PHP. It's just a simpler environment and for stuff like this, simpler seems better.
Developing with PHP is pretty easy. I don't miss not having an IDE, I don't miss have eclipse projects or ANT/Maven. I just point an ftp client at the server and edit with wordpad. Really easy. Edit/debug cycle is basically how fast your network is. It's pretty cool. Granted, it's just a web site but still, it works and it's fast and I could probably do this on a slow laptop with 256M of memory.
We need to figure out how to start making Java this productive for simple applications. A lot to learn here.