Designing Distributed Object Systems Ian Gorton, Paul Greenfield Advanced Distributed Software Arhitectures and Technologies CSIRO, Sydney
Designing Distributed Object Systems
Ian Gorton, Paul Greenfield
Advanced Distributed Software Arhitectures and Technologies
CSIRO, Sydney
Who is CMIS?• CSIRO is Australia’s largest scientific R&D
organisation and has around 7000 staff
• CSIRO Mathematical and Information Sciences
is – Australia’s premier group of mathematicians and Information
Technology specialists working to improve performance in
Australian industry.
ADSaT • 11 person R&D group, Sydney and
Canberra
• Involved in software engineering R&D
• Specifically looking at the problems of distributed systems, eg
• architecture, components, technologies
• testing and analysis
• performance, scalability, reliability
Architecture Issues
Solution Space
Physical constraints
Performance Requirements/Scalability
Security
Technologies, Components
Testing
Fault Tolerance
Trade-offs between competing forces can be extremely
complex
Management
Transactions
ADSaT capabilities• Designing software architectures
• Expertise in enterprise distributed technologies (eg COM, ORBs, DCE, Java), transactions, databases
• Research based around software architectures
• In-depth knowledge of Internet and e-commerce issues
Week1 Distributed Systems Technology
Overview
Acronym frenzy!!
What is Middleware?
Software plumbing and
associated services for building
distributed systems
Basic distributed systems blocks
• Provides high(ish) level facilities (RPC, RMI) for building distributed system communication infrastructures
• Hides low level issues from the programmer through abstraction Network/OS
TCP/IP
CORBA/RMI/COM
Component Technologies
The Next Big Thing??
Associated Services• Basic middleware
add-ons• Fulfill common
application needs in distributed systems
• See CORBA Services spec for an example and comprehensive list Middleware Plumbing
Secu
rity
Tra
nsa
ction
s
Dire
ctory
Messa
gin
g
Middleware Technologies• CORBA
• COM
• Java
• DCE
• Proprietary, ie– Forte, Tuxedo, CICS, etc..– TIBCO, MQ, etc..
So What is it Good For?• Geek answer…
• Middleware makes it feasible ‘for mere mortals’ to build distributed software systems that are:
– high-performance, scalable
– reliable, high availability
• Don’t be fooled. Distributed systems are inherently difficult to build.
Er..try me again?
• The bottom line answer...
• Businesses need a WWW presence• secure, transactional accesses to business systems
• Integration• mergers, acquisitions, virtual enterprises
• Internet competition and time-to-market
Some Gartner Survey Figures
• To develop a currently competetive e-commerce site:
• 5 months average duration (some 1 year+)
• uses more than 1 consulting organization
• cost average US$1 million (~$350K-$2m+)
• 79% costs were labor, 10% s/w
• No enterprise WWW site was ‘on budget’
Gartner Group Predictions
• Simple site - $300k-$1 million
• Competetive site - $1-5 million
• Market leader - $5-20 million
• Site costs will increase 25% annually in next few years
Solving Business Problems with Middleware
• Legacy system access
• Data integrity
• Scalability
• Availability
• Client access
Legacy System Access• Ease legacy system
integration by providing standard interfaces (wrappers)
• Hides details of legacy systems from clients
CICS\VSAMAS400
Middleware Wrappers
Clients Clients
MQ CICSGateway
Server Server
Data Integrity• Ensuring data integrity
with distributed databases requires transactions
• Transactions ensure ACID properties
SQL ServerOracle
Clients Clients
SQL ODBC
Server Server
TP Service
Scalability• Middleware
supports scaling system performance by service replication
• This isn’t free - it requires good architecture! Clients Clients
Server Server
Availability• Replication enhances
fault tolerance and improves availability
• Graceful degradation, lower performance but it keeps running
Clients Clients
Server Server
Client Access• Client access
enhanced due to:– physical distribution– variety of access
technologies (ie Internet protocols, IIOP, COM) and available bridges.
Clients Clients
ServerWWWServer
IIOP
Clients
IIOP
COM Bridge
HTTP
Enterprise Middleware Products
• Some terminology first:• Middleware - basic products
• Orbix, Visibroker, DCE, Java RMI, COM
• Object Transaction Monitor (OTM)• middleware plus enterprise systems capabilities,
OrbixOTM, BEA WebLogic
• Application Server• cynical answer - new name for OTMs with Java 2
Enterprise Edition support :-}
N-Tier System ArchitectureClient layer (browser, applets, apps)
Business Logic (CORBA objects, EJBs, COM+)
Data Access (DBMSs)
WWW server (WWW server, JSPs, ASPs)
http, IIOP, COM, RMI, XML
IIOP, COM, RMI, XML
SQL, ODBC, JDBC, XA
Standards (wot standards?)
• CORBA - OMG
• Java 2 Enterprise Edition (EJB+JMS+JNDI+…) - Sun
• COM+ - Microsoft
• MQ Series - IBM
• TIBCO multicast protocol..
• ???
CORBA
• OMG is vendor consortium
• CORBA Interface Definition Language (IDL)
• Internet Inter-ORB Protocol (IIOP) (GIOP over TCP/IP)
• CORBA services, eg transactions, naming, events, security
Java
• Remote Method Invocation (RMI)• Sun’s JRMP or RMI-over-IIOP
• Enterprise Java Beans (EJBs)
• Java Transaction Service (JTS)• Java mapping to CORBA OTS
• Java Naming and Directory Interface (JNDI)
• Java Messaging Service (JMS)
EJBs• EJBs are server-side components
• Separate business logic from infrastructure code
EJBEJB EJB
EJB Container
EJBs
• EJBs capture design patterns:• Stateless Session Bean
• Stateful Session Bean
• Entity Bean (bean or container managed)
• Containers/EJB Servers provide:• transaction policies
• security policies
• database connection pooling
• multi-threading
Transaction Service
• Essential for distributed transaction processing
• Manages consistent updates to multiple databases
• CORBA OTS, Java JTS, M’soft MTS
• X/Open DTP standards - XA
ACID properties
• A set of operations that have ACID properties:– Atomic– Consistent– Isolated– Durable
• Classic example - a bank account transfer
Java Transaction Example
try {// Create a transaction.transaction.begin();// Invoke operations in transactionsavingsAccount.makeWithdrawal(50)chequeAccount.makeDeposit(50);// Commit the transaction.transaction.commit(true);
} catch (APP_ERROR ex) {transaction.rollback()
} catch (TRANSACTION_ROLLEDBACK ex) {// handle rollback}
Two-Phase CommitApplication Program
Transaction Manager
Resource Manager (RM)
commit
Prepare tocommit
Response(commitof abort)
commit orabort
Acknowledge
X/Open Distributed TP Reference Model
Application Program
Transaction Manager
Resource Manager(RM)
CommunicationsResource
Manager(CRM)
TX
XA
TxRPCXATMICPI - C
XA+
XA Interface details• Database must implement an XA library
compatible with transaction service product
• embedded SQL
• ODBC/DTC for SQL Server
• OCI for Oracle
• ??? Others...
• JDBC-2 incorporates XA support
• No XA - no distributed transactions
Directory Service
• Clients need to get references to server objects
• Server objects advertise their reference in a directory service
• Clients query the directory service to retrieve desired reference
• CORBA Naming service, JNDI, LDAP
Example Name Space
Bank
AccountsLoansStocks
QueryStock
NewStockService
HomeLoan
BusLoan
AccountService
Security
• Provide:• user authentication
• user/service authorization
• encryption
• Secure Socket Layer (SSL)• public key infrastructure
• asymmetric private and public keys
• X.509 digital certificates
Messaging
• Many apps require asynchronous communications
• CORBA event/notifcation/messaging service
• Java Messaging Service
• TIBCO/Rendezvous
• MQ Series
• others…
• More on these later...
WWW Server Tier
• Need to accept HTML requests via HTTP post or get
• CGI scripts first used to add processing capability:
• spawn new process for each request
• slow, doesn’t scale
• Proprietary improvents• Netscape’s NSAPI, Microsoft’s ISAPI
Java Servlets/Server Pages
• Java platforms includes specs for:• servlets
• Java Server Pages (JSPs)
• Java servlets launched by WWW Server in response to URL request
• JSP’s allow code (eg Java beans) for formatting dynamic content to be embedded in HTML page
Java Servlets/Server Pages
WWWServer
URL JSP
App.Server
Component
Servlet
results
query
query
results
html
html
invoke
invoke
HTML
Extensible Markup Language (XML)
• Subset of SGML
• Standard textual format for structured documents
• Document Type Definition (DTD) defines document structure with tags for each entry in the document
• XML document instance contains both tags and document data
• Text format is easy to process
Sample DTD<?xml encoding="US-ASCII"?>
<!ELEMENT orders (order)*>
<!ELEMENT order (header,item+,total)>
<!ELEMENT header (billing_info,shipping_info)>
<!ELEMENT billing_info (name,address,credit_card)>
<!ELEMENT shipping_info (name,address)>
<!ELEMENT name (given,family)>
<!ELEMENT address (street,city,state,zipcode,country,phone)>
<!ELEMENT item (product_id,product_name,quantity,price)>
<!ELEMENT credit_card (#PCDATA)>
<!ELEMENT given (#PCDATA)>
<!ELEMENT family (#PCDATA)>
[…ELEMENTS MISSING…..]
<!ELEMENT product_id (#PCDATA)>
<!ELEMENT product_name (#PCDATA)>
<!ELEMENT quantity (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT total (#PCDATA)>
Sample (Incomplete) XML Document<?xml version="1.0"?>
<!DOCTYPE orders SYSTEM "orders.dtd">
<orders>
<order>
<header>
<billing_info>
<name>
<given>John</given>
<family>Doe</family>
</name>
<address>
<street>555 Main Street</street>
<city>Mill Valley</city>
<state>California</state>
<zipcode>94520</zipcode>
<country>USA</country>
<phone>707 555-1000</phone>
</address>
Extensible Style Language (XSL)
• XML ignores presentation of data
• XSL stylesheets define presentation of XML doc in some format
XMLDoc
XSL
Compiler HTML, PDF,etc...
in browser or WWW server
XML/XSL Impact
• Major vendor support/momentum
• Presentation• Decoupling content/presentation is good!
• Presentation is the browser’s job
• Data interchange• business-to-business e-commerce
• DOM API - XML parsers produce a DOM representation of an XML document
• Microsoft’s SOAP
Summary
• Distributed object system technology is a key part of building enterprise distributed systems
• There’s a lot of :• design issues
• technology issues
• plain hard issues (ie testing)
• This course is just the ‘entrée’...