160 likes | 275 Views
EJB Architecture Design Strategies and Performance Optimizations. James Lynn Hewlett-Packard Middleware Division. EJB Patterns Remote Object Considerations Cost of Network and Marshalling Controlling Cost Session Issues Stateful vs. Stateless Transactioning JTA JTS. Agenda. EJB Pattern.
E N D
EJB Architecture Design Strategies andPerformance Optimizations James LynnHewlett-Packard Middleware Division
EJB Patterns Remote Object Considerations Cost of Network and Marshalling Controlling Cost Session Issues Stateful vs. Stateless Transactioning JTA JTS Agenda
EJB Pattern App Server Host RMI Registry Host J2EE Server JNDI Naming Service RMI Registry Client Host Client EJB Server DBMS Host DBMS EJBs
EJB Pattern Details Home Interface Client Host App Server Host Client J2EE Server EJB Home Stub EJB Home Skeleton EJB Home EJB Object Stub EJB Object Skeleton EJB Object EJB Remote Interface
Cost of Remote Objects Network Latency Marshalling Cost Control Measures Granularity Partitions Remote Objects
Session/Entity EJB Pattern App Server Host J2EE Server JNDI Naming Service DBMS Host Client Host Client EJB Server DBMS Session EJBs Entity EJBs
Business logic is implemented in Session EJB instead of client Reduces network traffic Avoids redundancy among multiple similar clients Transactions among multiple Entity EJBs are handled by Session EJB, not by client Reduces likelihood of database corruption Avoids redundancy among multiple similar clients Session EJB Pros
Stateful Session Beans require 1-1 correspondence May impact memory requirements Stateless Session Beans may be pooled Potentially less memory required Possible increase in cost with respect to CPU Stateless Session Beans
Message-Driven EJB Pattern App Server Host J2EE Server Message- Driven EJBs DBMS Host JMS Client Host JMS Server Host EJB Server JMS Server JMS Client DBMS Session EJBs Entity EJBs
Allows for asynchronous message processing Messages are processed with all the benefits of EJB Message-Driven EJB Pros
Standalone Mode EJB Pattern App Server Host RMI Registry Host JNDI Naming Service RMI Registry Client Host Standalone Client HP Bluestone EJB Server DBMS Host DBMS EJBs
Servlet EJB J2EE transaction platform J2EE Components • J2EE requires a JTA • Transactions can be started by • J2EE components • J2EE application client • Transactions can be propagated from one J2EE platform to other J2EE platforms JSP <tx:begin> <sql>…</sql> <sql>…</sql> </tx:begin> Resource specific api UserTransaction JTS Resource XA Wrapper JTA JTA-XAResource JTS Physical Resource
Interposition No Interposition • Reduces network resources • Optimized orchestration of 2PC Machine 1 Machine 2 Client Application/Component Transaction Resource Commit prepare TS Transaction Resource commit With Interposition Machine 1 Machine 2 Client Application/Component Transaction Resource Commit TS TS prepare Transaction Resource commit
Diagram Key Entities (note shape) Entity Provider (note shading) Vendor-provided or generated Host computer Process Custom Java object(s) Vendor-provided You must customize Text file Type of Communication DBMS Method call Network