Today I took some time to deploy and fine tune a new MP3 jukebox with a Web interface to improve the level of aural democracy here at SitePoint HQ. As I’ve mentioned here before, I’ve written it as a Java Web application because what it needs to do on the server side is a lot more complex than anything I’d like to tackle with, say, PHP.
When the application starts up on the server, it creates a socket connection to the jukebox server (which happens to be running on the same machine). The jukebox server notifies the Web application of changes made by logged-in users. Speaking of which, each logged-in user creates an additional connection to the jukebox server, in order to issue commands on behalf of that user.
Although the interface is still fairly utilitarian, it’s coming along nicely:
Getting the application up and running took all of 30 minutes, including downloading and setting up Java, Tomcat and Ant, building and configuring the jukebox server from CVS, and installing my compiled Web application. But my work didn’t end there.
The computer in our server rack that is dedicated to the MP3 jukebox is quite a crusty old thing (a Celeron 533MHz with 128MB RAM), and at first didn’t seem up to the task of Java MP3 playback while simultaneously processing search requests from a half-dozen users through the Web application.
On the advice of Lachlan (the other Java geek here), I replaced Tomcat 5.5 with Jetty and saw an immediate improvement. Jetty starts up more quickly, and is considerably easier on the CPU and memory. The only time playback skips now is if a JSP needs to be recompiled on-the-fly, which isn’t an issue since it’s not a development server.
Jetty has full support for the Servlet 2.4 spec (including JSP 2.0), can be set up with virtual hosts and is embeddable within Java applications if needed. It does lack a few of the bells and whistles of Tomcat (Apache connectivity, load sharing, etc.), but if all you need is a simple Java Web application server that won’t waste your overloaded server box’s resources, Jetty is now my top pick.
Edit: On further investigation, Jetty does support apache integration.
That said, my past complaints about the beginner-unfriendliness of Tomcat stand for Jetty, whose XML configuration file actually maps to a series of Java method calls. As a result, you need to look through Java API documentation to figure out how to tweak Jetty’s configuration (and of course there is little or no documentation to suggest this).
When will someone make an up-to-date Java Web application server with a usable configuration and administration interface?