Software Engineering with Reusable Components

Download Report

Transcript Software Engineering with Reusable Components

Software Architecture
in Practice
RiSE’s Seminars
Bass’s et al. Book :: Chapter 16
Fred Durão
July 23th, 2005
Summary

J2EE/EJB (Chapter 16)





The J2EE Architectural Solution
The EJB Architectural Solution
EJB Programming
Deployment Descriptors
System Deployment Decisions
July 23th, 2005
2
J2EE/EJB – A case study of an
Industry-Standard Computing
Infrastructure
July 23th, 2005
3
J2EE/EJB :: Chapter 16
History

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
July 23th, 2005
4
J2EE/EJB :: Chapter 16
Requirements and qualities


“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…
July 23th, 2005
5
J2EE/EJB :: Chapter 16
Architectural Solution


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








July 23th, 2005
Fonte:http://java.sun.com/j2ee/appmodel.html
6
J2EE/EJB :: Chapter 16
The EJB Architectural Approach
July 23th, 2005
Fonte: http://info.borland.com/techpubs/jbuilder/jbuilder2005/enterprise/images/ejb-architecture.gif
7
J2EE/EJB :: Chapter 16
The EJB Architectural Approach {2}

Session Beans



Stateless session beans
Stateful session beans
Entity Beans


Container Manager Persistence
Bean Manager Persistence
July 23th, 2005
8
J2EE/EJB :: Chapter 16
The EJB Architectural Approach
– achieving
qualities
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
July 23th, 2005
9
J2EE/EJB :: Chapter 16
EJB - Programming

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
July 23th, 2005
10
J2EE/EJB :: Chapter 16
EJB – Programming {2}
July 23th, 2005
11
J2EE/EJB :: Chapter 16
EJB – Entity Bean
July 23th, 2005
12
J2EE/EJB :: Chapter 16
EJB – Interface Home
July 23th, 2005
13
J2EE/EJB :: Chapter 16
EJB – Remote Interface
July 23th, 2005
14
J2EE/EJB :: Chapter 16
Deployment Descriptor

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
July 23th, 2005
15
J2EE/EJB :: Chapter 16
Deployment Descriptor – ejb-jar.xml
July 23th, 2005
16
J2EE/EJB :: Chapter 16
Database Descriptor
July 23th, 2005
17
J2EE/EJB :: Chapter 16
State Management – A performance decision

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
July 23th, 2005
18
J2EE/EJB :: Chapter 16
Entity Bean –


to Use or Not Use? That’s the question
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:



Containers…are the black boxes
Bad state management
Additional beans participate in the transaction
July 23th, 2005
19
J2EE/EJB :: Chapter 16
Distribution and Scaling Issues

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
July 23th, 2005
20
J2EE/EJB :: Chapter 16
Distributed Transactions

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?
July 23th, 2005
21
J2EE/EJB :: Chapter 16
Resource Pooling Transactions

Connections to the databases do not need to be reestablished continuously, thus improving
application performance
July 23th, 2005
22
J2EE/EJB :: Chapter 16
Dependence on Java Virtual Machine Performance

If the heap size is big, garbage collection will be
infrequent…and this can slow down the server
processing, giving the impression that the server is
slow in unresponsive
July 23th, 2005
23
J2EE/EJB :: Chapter 16
References

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”
July 23th, 2005
24