| |||||||||||||
Since EJB 2.0 is a dramatic change from previous EJB specifications, there are a number of preconceptions about EJB that no longer apply. With the new EJB 2.0 changes, EJB is now suitable for smaller web sites, including sites running on only a single server.
CMP is about Database ManagementThe preconception is that EJB is about distributed objects. This preconception has an element of truth, but is no longer complete accurate. EJB was originally designed as a distributed object specification; database management was an afterthought. With EJB 2.0 and especially with the new local interfaces, database managment is central to EJB and distributed objects can be thought of as an afterthought. With the new spec, it's perfectly reasonable to think of EJB as a JDBC replacement with the option to provide remote interfaces if the site grows large enough. CMP method calls are faster than EJBCalls through the new local interfaces are now fast. Method arguments are passed by reference and the request never goes across a slow protocol like RMI or CORBA/IIOP. The local interface calls are slower than regular message calls because EJB method calls support database transactions. Because the EJB transaction support enables aggressive database caching, the performance of an application will likely be better than one using raw JDBC calls.
CMP is for small database applications, tooWith the addition of local interfaces, EJB is now suitable for all web applications from simple weblogs to huge financial applications. The preconception that EJB is for large systems is due in part to application server vendor marketing, in part due to journalists, and in part due to the initial distributed object focus of EJB. Vendors and journalists are impressed with large configurations. The mega-applications are impressive: amazon.com, eBay and Schwab's web trading are a big deal. The vast majority of sites are much smaller and don't have the same requirements as the mega-sites. In particular, the most sites have no need for distributed objects. Many sites, in fact, only need a single web server. Since many projects fail because of overdesign, good engineers design small, elegant solutions. Since most web applications don't need distributed objects, a good engineer will avoid adding the extra complexity just because journalist writes a breathless article describing a huge distributed object solution.
|