I read Gavin's post. For very large Hibernate-centric, database-centric applications, it would be hard to argue with his points.
On the issue of technology -- a general purpose, scalable distributed synchronization service is definitely a PhD level problem. There are hundreds of papers written by computer scientists on the subject. You'd have to be pretty desperate to consider writing your own full-blown, full-featured service.
But consider the case of small servers that will seldom consist of more than one running JVM instance. In the past five years our group has implemented dozens of these small back-end special purpose servers. They all have a common requirement -- they must exhibit extremely low latency as perceived by the client of the server (usually another server). They also have another thing in common: very complex object models and logic.
Our requirements are such that we scrutinize every single I/O call to the database and try to find ways to eliminate it. We cache enormous amounts of data. We use connection pools that don't have to hit the database or perform any I/O to verify connections (it can be done). We don't even call commit on every transaction, if that transaction only performed selects or only read from the cache. Thus many transactions operate at full memory speed without incurring any I/O whatsoever.
Up to now we've been using our own hand-crafted ORM. It is a bare bones transparent persistence service that offers very few features, and it does not scale well past a single JVM. But it is fast, very fast. And it easily handles 800 concurrent, very low-latency transactions, when running on a large multi-cpu machine. It also does in-memory pessimistic locking at sub-microsecond speeds.
But we've always yearned for a full-featured ORM like Hibernate. But Hibernate was never a contender until it gained the second-level cache and the query cache. These two caches allow us to keep a significant chunk of our object graph in ram, portions of which must appear concurrently in the hundreds of concurrent transactions (so we can't use the attach/detach approach).
Performance testing shows us that Hibernate achieves 85% to 90% overall performance of our custom ORM. It is amazing that a full featured, general purpose ORM can compete with a such a bare-bones, special purpose service. The design of Hibernate and the creative talents of Gavin and company totally blows us away.
There are couple of sticking points. We need pessimistic locking here and there. If we did it using the database, Hibernate would no longer be competitive with our custom ORM. Not even in the same ball park. So we're working on solving this problem (for our specific case of the small server that does not need to scale -- for large, scalable servers, we totally agree with Gavin's philosophy).
We also sometimes have the need to run a small cluster of no more than two or three JVMs. Our custom ORM can do the necessary cache sync and primitive distributed locking orders of magnitude faster than going to Oracle. But it won't scale past four JVMs. So that's the tradeoff.
Hibernate is great and it is scalable to really big applications. Hibernate also scales down really well, but I think more can be done in this direction -- to wring out every gram of performance for the small scale app. Who knows, maybe Hibernate could some day be used in true Real-Time apps, as well as the truly huge apps.
--Jeff
|