Upload
regina-blankenship
View
217
Download
0
Tags:
Embed Size (px)
Citation preview
COMP 655:Distributed/Operating
SystemsSummer 2011
Dr. Chunbo ChuWeek 11: System Examples
04/21/23 1Distributed Systems - COMP 655
04/21/23 Distributed Systems - Comp 655 2
Distributed system examples
• Commercial middleware– J2EE Overview– .NET Overview
• Web services: where middleware systems meet
• Web service from Open Source middleware
04/21/23 Distributed Systems - Comp 655 3
Java EE Overview
• The problem Java EE attempts to solve: maximize the use of Java technologies by providing a suite of Java technology specifications that is– Integrated– Suitable for enterprise applications– Widely available– Includes all of the basic middleware
capabilities for building distributed systems
04/21/23 Distributed Systems - Comp 655 4
Enterprise applications require• High throughput
– Load balancing– Efficient communications
• High availability• Highly reliable communications• Persistent, asynchronous communication
option• Distributed transactions• High security• Ability to interoperate with whatever• Structured naming with de-centralized
administration
The Java™ Platform
High-EndServer
Java Technology Enabled Desktop
WorkgroupServer
Java Technology Enabled Devices
04/21/23 Distributed Systems - Comp 655 6
The 3 Cs of Java EE
Components
Containers
Connectors
04/21/23 Distributed Systems - Comp 655 7
J2EE Overview
04/21/23 Distributed Systems - Comp 655 8
Key middleware services• Communication: RMI-IIOP, JMS• Naming: JNDI (part of Java SE)• Persistence: JPA, JDBC, JDO• Transactions: JTA, JTS• Security: (next page)
04/21/23 Distributed Systems - Comp 655 9
Java SE 6 Security Features
• JAAS – Java Authentication and Authorization Service
• JCE – Java Cryptography Extension• JSSE – Java Secure Socket Extension• Java GSS-API – Kerberos V5 secure
communications• JSSE - Java Secure Socket Extension• More…
04/21/23 Distributed Systems - Comp 655 10
Java EE for web services• Java Architecture for XML Binding (JAXB)• Java API for RESTful Services (JAX-RS)• Java API for XML-Based Web Services (JAX-WS)• SOAP with Attachments API for Java (SAAJ)• Java API for XML Messaging (JAXM)• Java API for XML Processing (JAXP)• Java API for XML Registries (JAXR)• Java API for XML-Based Remote Procedure Call
(JAX-RPC)
04/21/23 Distributed Systems - Comp 655 11
Enterprise Java Beans
• A server-side component technology
• Easy development and deployment of Java technology-based application that are:– Transactional, distributed, multi-tier,
portable, scalable, secure, …
Enterprise Java Beans• Session beans
– Represent business processes and data about an interaction with a client
– Two types:• Stateless• Stateful
• Entity beans (FROZEN at EJB 2.5)– Represent persistent data and data integrity
rules– Two types of persistence:
• Container-managed persistence• Bean-managed persistence
04/21/23 Distributed Systems - Comp 655 12
04/21/23 Distributed Systems - Comp 655 13
Invoking an EJB method
Client
HomeObject
EnterpriseBean(s)
EJB Container
JNDI
NS, egLDAP
1. Request home object
1 2
2. Return home object reference
3
3. Request new EJB object
EJBObject
4
4. Create EJB object
5
5. Return EJB object reference
6
6. Invoke method
7
7. Delegate request to enterprise bean(s)
04/21/23 Distributed Systems - Comp 655 14
Message-driven beans• MDB are stateless beans that
– Listen for and handle JMS messages– Participate in transactions if necessary
• MDB have no– Home interface– Remote interface– Interfaces directly callable by clients (clients
just send messages)
An MDB tutorialAn MDB article
04/21/23 Distributed Systems - Comp 655 15
If you remember one thing• Enterprise beans are
– Single-threaded– Ignorant of security– Ignorant of transactions– Ignorant of networking
• The container handles all that• Containers tend to be pricey
04/21/23 Distributed Systems - Comp 655 16
Leading EJB containers• Oracle/BEA Weblogic• IBM Websphere• JBoss (open source)• GlassFish (open source)• Geronimo (open source)
04/21/23 Distributed Systems - Comp 655 17
Deployment descriptors• Deferred binding for many of the
things the bean developer need not worry about, including– Access control– Transaction requirements– Persistence parameters– Type of bean– Classes used for home and remote
interfaces
04/21/23 Distributed Systems - Comp 655 18
Deployment descriptor example
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD EnterpriseJavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar> <description>Deployment descriptor for the samplemdb JOnAS example</description> <display-name>samplemdb example</display-name> <enterprise-beans> <message-driven> <description>Describe here the message driven bean Mdb</description> <display-name>Message Driven Bean Mdb</display-name> <ejb-name>Mdb</ejb-name> <ejb-class>samplemdb.MdbBean</ejb-class> <transaction-type>Container</transaction-type> <acknowledge-mode>Auto-acknowledge</acknowledge-mode> <message-driven-destination> <destination-type>javax.jms.Topic</destination-type> <subscription-durability>NonDurable</subscription-durability> </message-driven-destination> </message-driven> </enterprise-beans> <assembly-descriptor> <container-transaction> <method>
<ejb-name>Mdb</ejb-name><method-name>*</method-name>
</method> <trans-attribute>Required</trans-attribute> </container-transaction> </assembly-descriptor></ejb-jar>
Java EE
04/21/23 Distributed Systems - Comp 655 19
04/21/23 Distributed Systems - Comp 655 20
Java EE 6• Defined by JSR 316• Adds
– JAX-RS (JSR 311)– Web Beans (JSR 299)– Java Authentication SPI for containers (JSR
196)
• Removes– EJB Container-managed persistence– JAX-RPC
• And other changes• Approved over
a variety of concerns and objections
04/21/23 Distributed Systems - Comp 655 21
EJB 3• Developer does not have to implement EJB
interfaces• EJB interface implementations inferred from
annotations (for example @Stateless)• In many cases, explicit deployment
descriptors are not needed• In many cases, deployment information can
be inferred from annotations (for example @Stateless)
• Enterprise beans frozen at version 2.5, replaced by Java Persistence API (JPA), based on Hibernate
04/21/23 Distributed Systems - Comp 655 22
EJB 3, continued• In many cases, explicit JNDI
lookups are not necessary• In many cases, system can infer
the required lookup from annotations (for example, @EJB)
04/21/23 Distributed Systems - Comp 655 23
Web sites (3 of thousands)Sun’s J2EE site:
http://java.sun.com/javaee/
Mastering EJB 3.0 (downloadable)
EJB design patterns (downloadable)
J2EE Architect’s Handbook (downloadable)
Connector• Defines standard API for integrating J2EE
technology with EIS systems– CICS, SAP, PeopleSoft, etc.
• Before Connector architecture, each App server has to provide an proprietary adaptor for each EIS system– m (# of App servers) x n (# of EIS's) Adaptors
• With Connector architecture, same adaptor works with all J2EE compliant containers– 1 (common to all App servers) x n (# of EIS's)
Adaptors
04/21/23 Distributed Systems - Comp 655 26
.NET Overview• The problem .NET tries to solve:
maximize the sale of server-side licenses by providing a suite of Windows technologies that is– Integrated– Suitable for enterprise applications– Includes all of the basic capabilities
for building distributed systems
Operating System + Hardware
.NET Framework
.NET Application
• Platform for running .NET managed code in a virtual machine
• Provides a very good environment to develop networked applications and Web Services
• Provides programming API and unified language-independent development framework
.NET Framework
The Core of .NET Framework
• Common Language Runtime– Garbage collection– Language integration– Multiple versioning support (no more
DLL hell!)– Integrated security
• Framework Class Library– Provides the core functionality:
ASP.NET, Web Services, ADO.NET, Windows Forms, IO, XML, etc.
.NET Framework Common Language Runtime
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
– CLR manages code execution at runtime
– Memory management, thread management, etc.
.NET Framework Base Class Library
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
– Object-oriented collection of reusable types
– Collections, I/O, Strings, …
.NET Framework Data Access Layer
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
– Access relational databases– Disconnected data model– Work with XML
.NET Framework ASP.NET & Windows Forms
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
– Create application’s front-end – Web-based user interface, Windows GUI, Web services, …
.NET Framework Programming Languages
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
C++C++ C#C# VB.NETVB.NET PerlPerl J#J# ……
– Use your favorite language
.NET Framework Common Language Specification
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language SpecificationC++C++ C#C# VBVB PerlPerl J#J# ……
.NET Framework Visual Studio .NET
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language Specification
C++C++ C#C# VBVB PerlPerl J#J# ……
Visu
al S
tud
io .N
ET
Visu
al S
tud
io .N
ET
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Services Web FormsWeb Services Web Forms
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language Specification
C++C++ C#C# VBVB PerlPerl J#J# ……
Visu
al S
tud
io .N
ET
Visu
al S
tud
io .N
ET
Open LanguageSpecification
C# Language – Submitted to ECMA
XML-baseddata access
Web services –XML, SOAP-based
.NET Framework Standards Compliance
04/21/23 Distributed Systems - Comp 655 37
.NET programming languages
04/21/23 Distributed Systems - Comp 655 38
Key middleware services (.NET)
• Communication: SOAP, http, ORPC• Naming: URI, DNS, COM+ Catalog,
Windows Registry• Persistence: ADO, OLE-DB• Transactions: MTS• Security: SSL, Kerberos, NTLM
04/21/23 Distributed Systems - Comp 655 39
J2EE vs .NET• Microsoft says:
– .NET is faster– You write less code and easier code
with .NET– www.gotdotnet.com/team/compare/default.aspx
• Sun says:– .NET is a closed system– .NET is immature– .NET lacks community– java.sun.com/features/2002/07/rimapatel.html
(NOTE: this is getting old) (Java in grade school?)
04/21/23 Distributed Systems - Comp 655 40
J2EE vs .Net continued• IBM says
– Only 26% of mid-market companies have Windows only
– .Net locks you into Windows– Microsoft competes with its partners– Our WebSphere-based J2EE platform
is cheaper than a comparable server-side .Net platform
– Read all about it
04/21/23 Distributed Systems - Comp 655 41
Web Services• Where middleware systems meet• The idea: allow clients to find and
interact with services over the web without regard to how the clients or services are built
• How do you do that? With standards …
• This is a MAJOR industry bandwagon, as you probably know
04/21/23 Distributed Systems - Comp 655 42
SOAP overview
What’s the difference between RPC and request/response?
Protocols include HTTP, SMTP, TCP, MSMQ, …
04/21/23 Distributed Systems - Comp 655 43
SOAP intermediaries
04/21/23 Distributed Systems - Comp 655 44
SOAP is (v1.2)
SOAP is a lightweight protocol intended for exchanging structured information in a decentralized, distributed environment. SOAP uses XML technologies to define an extensible messaging framework, which provides a message construct that can be exchanged over a variety of underlying protocols. The framework has been designed to be independent of any particular programming model and other implementation specific semantics.
msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsoap/html/understandsoap.asp
04/21/23 Distributed Systems - Comp 655 45
SOAP message structure<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header> <!-- optional -->
<!-- header blocks go here... -->
</soap:Header>
<soap:Body>
<!-- payload or Fault element goes here... -->
</soap:Body>
</soap:Envelope>
04/21/23 Distributed Systems - Comp 655 46
SOAP message example<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<x:TransferFunds xmlns:x="urn:examples-org:banking">
<from>22-342439</from>
<to>98-283843</to>
<amount>100.00</amount>
</x:TransferFunds>
</soap:Body>
</soap:Envelope>
04/21/23 Distributed Systems - Comp 655 47
SOAP response message example<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <x:TransferFundsResponse xmlns:x="urn:examples-org:banking"> <balances> <account> <id>22-342439</id> <balance>33.45</balance> </account> <account> <id>98-283843</id> <balance>932.73</balance> </account> </balances> </x:TransferFundsResponse> </soap:Body></soap:Envelope>
04/21/23 Distributed Systems - Comp 655 48
SOAP error message example
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Insufficient funds</faultstring> <detail> <x:TransferError xmlns:x="urn:examples-org:banking"> <sourceAccount>22-342439</sourceAccount> <transferAmount>100.00</transferAmount> <currentBalance>89.23</currentBalance> </x:TransferError> </detail> </x:TransferFunds> </soap:Body></soap:Envelope>
04/21/23 Distributed Systems - Comp 655 49
SOAP extensibility example<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <!-- security credentials --> <s:credentials xmlns:s="urn:examples-org:security"> <username>dave</username> <password>evad</password> </s:credentials> </soap:Header> <soap:Body> <x:TransferFunds xmlns:x="urn:examples-org:banking"> <from>22-342439</from> <to>98-283843</to> <amount>100.00</amount> </x:TransferFunds> </soap:Body></soap:Envelope>
04/21/23 Distributed Systems - Comp 655 50
Must-understand<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <!-- security credentials --> <s:credentials xmlns:s="urn:examples-org:security" soap:mustUnderstand="1" > <username>dave</username> <password>evad</password> </s:credentials> </soap:Header> ...
04/21/23 Distributed Systems - Comp 655 51
SOAP in HTTP
04/21/23 Distributed Systems - Comp 655 52
SOAP in context• SOAP is an extensible way to encode
requests and responses in XML• WSDL (Web Services Description
Language) is a way to describe the requests and responses a web service uses
• UDDI (Universal Description, Discovery and Integration) is a way of locating web services
04/21/23 Distributed Systems - Comp 655 53
WSDL• WSDL is an XML format for
describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information.
• http://www.w3.org/TR/wsdl
• Protocol bindings described: SOAP 1.1, HTTP GET/POST, MIME
04/21/23 Distributed Systems - Comp 655 54
UDDI• UDDI enables a business to
– describe its business and its services– discover other businesses that offer
desired services– integrate with these other businesses.
• http://www.uddi.org/
04/21/23 Distributed Systems - Comp 655 55
Dissent: REST• REST's proponents: the Web’s scalability and
growth result directly from a few key design principles:– Application state and functionality are divided into
resources – Every resource is uniquely addressable using a
universal syntax for use in hypermedia links – All resources share a uniform interface for the
transfer of state between client and resource: • Constrained set of well-defined operations • Constrained set of content types, optionally supporting
code-on-demand • A protocol that is:
– Client/Server – Stateless – Cacheable – Layered
04/21/23 Distributed Systems - Comp 655 56
REST resources• The previous slide came from
Wikipedia’s article• JAX-RS• Roy Fielding’s dissertation started
the “movement”• Del.icio.us is a well-known (almost)
example• Joe Gregorio on REST and WS-*• RESTful Web Services book
04/21/23 Distributed Systems - Comp 655 57
Web service from open source
• Two authors from HP– Chris Peltz– Claire Rogers
• Goal: set up a weather-forecast web service on a laptop, using all Open Source infrastructure
• http://sys-con.com/webservices/article.cfm?id=728
04/21/23 Distributed Systems - Comp 655 58
Decisions, decisions …• Linux distribution• DBMS• Programming language• Java runtime• Java IDE• Web container• Web service container• Build environment• Testing
04/21/23 Distributed Systems - Comp 655 59
Linux distribution• RedHat – closes the gap between
Windows and Unix, good for Linux novices
• SuSE – good for existing Windows users
• Debian – used by well-seasoned Linux developers [selected]
They also liked GNOME
04/21/23 Distributed Systems - Comp 655 60
Open source database• PostgreSQL – robust, full-featured• MySQL – maximize Web application
performance, but no stored procedures or triggers [selected]
It took several tries to get MySQL installed, but it worked well once it was set up.
04/21/23 Distributed Systems - Comp 655 61
Java SDK• J2SE SDK from Sun• Blackdown JDK• BEA’s JRockit [selected, primarily for
performance reasons]
• http://www.spec.org/ • http://www.theserverside.com/ecperf/
• They liked the “M x N” threading model
04/21/23 Distributed Systems - Comp 655 62
Another industry benchmark• www.tpc.org • TPC is best known for TPC-C, which
pioneered the $/tpmC approach• www.tpc.org/tpcc/results/tpcc_perf_results.asp
04/21/23 Distributed Systems - Comp 655 63
Java IDE• vi or emacs• NetBeans (based on Swing,
considered more platform-independent)
• Eclipse (based on SWT, considered faster and more attractive on-screen) [selected]
They liked Eclipse’s plug-insHP is developing several plug-ins
04/21/23 Distributed Systems - Comp 655 64
Web container• Resin• Jboss• Jetty• Tomcat [selected, for performance,
stability, and because it’s the default web container for Apache Axis]
They were able to start and stop Tomcat from Eclipse, with the help of a plug-in
04/21/23 Distributed Systems - Comp 655 65
Web services container• They concluded that Apache Axis
is currently the only “robust” open source web services platform.
They recommend writing your own WSDL for complex services, but for simple ones, Axis’ Java2WSDL is OK.
04/21/23 Distributed Systems - Comp 655 66
More on Apache AxisSome manual coding was needed
to adapt their server-side code to the web service environment (example: had to make the Forecast class a Bean so it could be serialized)
The hardest part was figuring out what had to change.
04/21/23 Distributed Systems - Comp 655 67
Build and test• Ant for building.• WSDL2Java from Axis generates a client
proxy class from the WSDL. Handy for testing.
• Axis tcpmon for monitoring SOAP traffic.• Web service testing tools
– JUnit– Grinder– Anteater– PushToTest TestMaker [selected]
• TestMaker scripts are written in Jython