Translate

Friday, November 23, 2012

TUNING EJBS



TUNING EJBS



•The performance of EJB-based JEE systems overwhelmingly depends on getting the design right
•Use the following performance-optimizing design patterns:

•Value Object, Page-by-page Iterator, ValueListHandler, Data Access Object, Fast Lane Reader, Service Locator, Verified Service Locator, EJBHomeFactory, Session Façade, CompositeEntity, Factory, Builder, Director, Recycler, Optimistic Locking, Reactor, Front Controller, Proxy, Decorator, and Message Façade.

•Explicitly remove beans from the container when a session is expired.

•Leaving beans too long will get them serialized by the container, which can dramatically decrease the performance.

•Coarse grained EJBs are faster.

•Remove EJB calls should be combined to reduce the required remote invocations.

•Design the application to access the entity beans only using session beans.

•EJBs should NOT be simple wrappers on database rows.

•They should have business logic.
•To simply access the data, use JDBC directly from the client applications.

•Stateless session beans are faster thean stateful session beans.
•If you have stateful session beans in your application, you may convert them as stateless by removing the member data and passing it method arguments to each of the methods.

•Optimize read-only EJBs to use

•Read-only transactions and
•Their own

•Design,
•Application server,
•Optimal configuration.

•Cache JNDI lookups
•Use CMP by default.

•Profile the application to determine which beans cause bottlenecks from their persistency, and re-implement the same using BMP for those.

•Don‘t be afraid to use layered architecture.

•Use the DAO design pattern to abstract your BMP implementations, so you can take advantage of optimizations possible when dealing with multiple beans or database specific features.

•Minimize the time spent in any transactions.

•But, don‘t shorten transactions so much that you are unnecessarily increasing the total number of transactions.

No comments: