Title: Software Architecture in Practice
1Software Architecturein Practice
- RiSEs Seminars
- Basss et al. Book Chapter 16
- Fred Durão
2Summary
- J2EE/EJB (Chapter 16)
- The J2EE Architectural Solution
- The EJB Architectural Solution
- EJB Programming
- Deployment Descriptors
- System Deployment Decisions
3J2EE/EJB A case study of an Industry-Standard
Computing Infrastructure
4History
J2EE/EJB Chapter 16
- In early 1990s was developed CORBA on which
- Distributed objects could communicate and
interact with each other seamlessly and
transparently. - After, Sun Microsystems pushed the Java
programming Language to support RMI (Remote
Method Invocation) - The Microsoft release the framework .Net
- In 1997 Sun Microsystems releases the framework
J2EE/EJB
5Requirements and qualities
J2EE/EJB Chapter 16
- The Wimbledon Tennis tournament experienced
almost 1 billion Web access in 1999, with 420.000
hits per minute (7000 per second) during one
match - J2EE/EJB aims to
- Provide a component-based architecture for
building distributed OO applications in Java - Scalability e.g. web access
- Availability 24/7
- Security - AA
- Usability access in different forms
- Performance latency
- Portability run in a variety of computing
platforms - Interoperability server side components
implemented on different vendors - Extensibility e.g. struts, JSF
6Architectural Solution
J2EE/EJB Chapter 16
- 3 major features
- A multi-tiered distributed application model
- A server-side component model
- Built-in transaction control
- Components and Services
- EJB server-side component
- JSP
- Java Servelt
- JMS Java Message Service
- JNDI
- JTS Java Transaction Service
- JCA Java Connector Architecture
- COM Bridge
- RMI over IIOP
- JDBC
- Fontehttp//java.sun.com/j2ee/appmodel.html
7The EJB Architectural Approach
J2EE/EJB Chapter 16
Fonte http//info.borland.com/techpubs/jbuilder/j
builder2005/enterprise/images/ejb-architecture.gif
8The EJB Architectural Approach 2
J2EE/EJB Chapter 16
- Session Beans
- Stateless session beans
- Stateful session beans
- Entity Beans
- Container Manager Persistence
- Bean Manager Persistence
9The EJB Architectural Approach achieving
qualities
J2EE/EJB Chapter 16
Goal Tactics Used
Availability/Reliability Heartbeat Transactions Passive Redundancy
Implementation Transparency Maintain existing interfaces Semantic Coherence
Interoperability Adherence to defined protocols
Performance Configuration Files Load balancing Maintain multiple copies
Scalability Load balancing
10EJB - Programming
J2EE/EJB Chapter 16
- To create EJB server-side component, the
developer must provide two interfaces - Home
- Contain the life cycle methods of the EJB
- Remote
- Business methods offered by the bean
11EJB Programming 2
J2EE/EJB Chapter 16
12EJB Entity Bean
J2EE/EJB Chapter 16
13EJB Interface Home
J2EE/EJB Chapter 16
14EJB Remote Interface
J2EE/EJB Chapter 16
15Deployment Descriptor
J2EE/EJB Chapter 16
- It is XML document associated with an EJB that
- Describes the type of the bean (session or
entity) - Describes the classes used for home, remote and
the bean classes - Specifies the transactional attributes (access
control) - Specified if the persistence in the entity bean
is handled automatically by the container or
performed explicitly by the bean code - This the SEMANTIC COHERENCE tactic implemented
16Deployment Descriptor ejb-jar.xml
J2EE/EJB Chapter 16
17Database Descriptor
J2EE/EJB Chapter 16
18State Management A performance decision
J2EE/EJB Chapter 16
- Stateful Session Bean
- Must be used to atomic actions
- else may high the overhead in terms of
application performance - Stateless Session Bean
- Many request to the server
- and persist the data on later
- E.g. shopping cart
19Entity Bean to Use or Not Use? Thats the
question
J2EE/EJB Chapter 16
- Typical e-commerce system with an 85 read-only
and 15 update transaction mix when implemented
with entity beans achieved only half of this
performance - Causes of degradations
- Containersare the black boxes
- Bad state management
- Additional beans participate in the transaction
20Distribution and Scaling Issues
J2EE/EJB Chapter 16
- Two ways of increasing the processing power in
the server tier - Scaling up, or vertical scaling
- Adding memory or faster processors in a single
machine - Scaling out, or horizontal scaling
- The server application is distributed across more
the one machine - Increased redundancy
- Cost efficiency
21Distributed Transactions
J2EE/EJB Chapter 16
- Two phase commit protocol is often essential in
building enterprise-wide system - Is it always necessary?
- What about the overhead involved in managing
them? - What about several remote calls that pass over
the network? - What about the architect experience for that?
22Resource Pooling Transactions
J2EE/EJB Chapter 16
- Connections to the databases do not need to be
re-established continuously, thus improving
application performance
23Dependence on Java Virtual Machine Performance
J2EE/EJB Chapter 16
- If the heap size is big, garbage collection will
be infrequentand this can slow down the server
processing, giving the impression that the server
is slow in unresponsive
24References
J2EE/EJB Chapter 16
- Bass L., Clements P. and Kazman R. Software
Architecture in Practice. Second Edition, 2003. - a luz no fim do túnel pode ser um trem vindo em
sua direção