24
July 23 th , 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

  • View
    216

  • Download
    2

Embed Size (px)

Citation preview

Page 1: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005

Software Architecturein Practice

RiSE’s SeminarsBass’s et al. Book :: Chapter 16

Fred Durão

Page 2: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 2

Summary

J2EE/EJB (Chapter 16) The J2EE Architectural Solution The EJB Architectural Solution EJB Programming Deployment Descriptors System Deployment Decisions

Page 3: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 3

J2EE/EJB – A case study of an Industry-Standard Computing Infrastructure

Page 4: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 4

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

J2EE/EJB :: Chapter 16

Page 5: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 5

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…

J2EE/EJB :: Chapter 16

Page 6: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 6

Architectural Solution 3 major features

A multi-tiered distributed application model A server-side component model Built-in transaction control

Fonte:http://java.sun.com/j2ee/appmodel.html

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

J2EE/EJB :: Chapter 16

Page 7: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 7

The EJB Architectural Approach

Fonte: http://info.borland.com/techpubs/jbuilder/jbuilder2005/enterprise/images/ejb-architecture.gif

J2EE/EJB :: Chapter 16

Page 8: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 8

The EJB Architectural Approach {2}

Session Beans Stateless session beans Stateful session beans

Entity Beans Container Manager Persistence Bean Manager Persistence

J2EE/EJB :: Chapter 16

Page 9: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 9

The EJB Architectural Approach – achieving qualities

Goal Tactics Used

Availability/Reliability HeartbeatTransactionsPassive Redundancy

Implementation Transparency Maintain existing interfacesSemantic Coherence

Interoperability Adherence to defined protocols

Performance Configuration FilesLoad balancingMaintain multiple copies

Scalability Load balancing

J2EE/EJB :: Chapter 16

Page 10: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 10

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

J2EE/EJB :: Chapter 16

Page 11: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 11

EJB – Programming {2}

J2EE/EJB :: Chapter 16

Page 12: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 12

EJB – Entity Bean

J2EE/EJB :: Chapter 16

Page 13: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 13

EJB – Interface Home

J2EE/EJB :: Chapter 16

Page 14: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 14

EJB – Remote Interface

J2EE/EJB :: Chapter 16

Page 15: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 15

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

J2EE/EJB :: Chapter 16

Page 16: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 16

Deployment Descriptor – ejb-jar.xml

J2EE/EJB :: Chapter 16

Page 17: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 17

Database Descriptor

J2EE/EJB :: Chapter 16

Page 18: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 18

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

J2EE/EJB :: Chapter 16

Page 19: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 19

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

J2EE/EJB :: Chapter 16

Page 20: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 20

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

J2EE/EJB :: Chapter 16

Page 21: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 21

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?

J2EE/EJB :: Chapter 16

Page 22: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 22

Resource Pooling Transactions

Connections to the databases do not need to be re-established continuously, thus improving application performance

J2EE/EJB :: Chapter 16

Page 23: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 23

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

J2EE/EJB :: Chapter 16

Page 24: July 23 th, 2005 Software Architecture in Practice RiSE’s Seminars Bass’s et al. Book :: Chapter 16 Fred Durão

July 23th, 2005 24

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”

J2EE/EJB :: Chapter 16