How good is the performance of EJB systems? Are there any benchmarks?

Alex Chaffee

EJB systems are designed to perform very poorly.

Very provocative, no? :-)

What I mean is this: EJBs allow you to make an application distributed and scalable. This can have a huge positive impact on performance -- if your application really is running in a cluster, on dozens of host machines simultaneously, with hundreds of simultaneous clients. However, the performance of each individual machine will usually be much slower than the same application running on a single app server. This is because of the overhead introduced by the EJB server managing your persistence and transactions for you.

However, like I said, this is by design. As a simple illustration of this, think about session data. In a simple web server environment, the session data is stored in RAM, and stays resident for the life of the client session. Access to this session data is very fast. In a distributed, EJB server environment, the session data may get swapped to disk between client requests, and the client may connect to a different host for the second request. This requires more work to save and load the data for each request, so performance must suffer. However, it also allows many more client sessions to be active simultaneously, and to make use of the same (limited) amount of RAM per machine, and to use many many many machines in your cluster.

EJB performance is a classic "hockey stick" curve: the performance suffers in the short term (small number of hosts), then improves greatly in the long term (large number of hosts). Another way to look at it is that it enables the "just throw money at it" solution (i.e. more servers) to actually have a chance of success.

As for benchmarking: as far as I know, nobody has done any benchmarks comparing different EJB servers, or comparing EJB with other similar technologies. And once they do, everyone will find problems with it, as usual.

Flame on! Please feel free to object violently to any of the above assertions. That's what the "feedback" function is for! :-)