Saturday, August 16, 2008

Enterprise Java

Jim recently blogged about what Enterprise worthy means to him. I agree fully with what he says, if Ruby had the same level of infrastructure that Java does, it might be considered enterprise worthy, just like Java. This won't happen for a very long time though.

Why? Simply put, Java has a huge head start. There is also progressions in the use of the language that IDE's such as Eclipse have made writing code a no-brainer. Such as: instant code compiling (remember when javac was slow?), re-factoring, code-finishing and code-completion. I just don't see C or Ruby having IDE support at the same level as Java for a long long time, if ever.

What makes Java enterprise worthy?

EJB3/Hibernate (clustered second level and query caching)
IDE support (Eclipse - easy code re-factoring is HUGE)
JSP taglibs
GWT (google web toolkit)
Jakarta (and similar projects with large amounts of released libraries)

I mention the above tools because I successfully work with nearly all of those technologies on a daily basis. Once you see millions and millions of hits being reliably served off of servers that are literally sleeping, using those technologies, you become sold on the idea that it is possible to create truly scalable web applications with a relatively minimal amount of work. For the most part, EJB3 and the associated annotations is actually a pleasure to work with.

Sam Ruby had a posting recently about how he was struggling to make Ruby (the language) scale to serve a feed. He talks about page caching, etags, simpler get support, action caching, fragment caching and sweepers. Oh my god, 6 different caching layers? That sounds like a train wreck to maintain, debug and understand. I like to call that a brittle system and I try to avoid anything that complicated as much as possible. After all these years, doing all this weird caching just to make something scale seems so brain dead to me. These problems have been solved and transparently implemented in the Java world for ages now, so why not make life easy and just use what works? For my feed generation (I do a lot of it in my support for Piclens), I use simple Velocity templates and populate the context with data objects that I got from my EJB3 entities. Nowhere do I need to worry about caching because the JVM performs as expected and the rest of the database caching is all handled for me. The code is simple and it all just performs like magic.

Even if things did slow down (and we have meetings about this at work every once and while), it all becomes a matter of adding more hardware to the cluster and/or making sure the caches are being allocated properly. I'm serving 15+ heavily trafficked porn sites on 3 standard server configurations. We really only need one server for all of this but we have 3 just for redundancy. It is relatively simple and it just works. I like that and that is what makes Java Enterprise worthy to me.

No comments: