distributed computing and java - · pdf filedistributed computing and java ... what is the...
TRANSCRIPT
2
Topics
Overview of Distributed computing Java APIs for distributed computing
JDBCRMIJava IDL (Corba)Java Servlets and JSPJ2EE™
Jini™ Network Technology and JavaSpaces (We will learn from next week)
3
Objectives
Understand the value of distributed computing (network computing)
Get some exposure to the evolution of distributed computing
Understand the 7 fallacies of distributed computing
Get some exposure to distributed computing technologies of Java
Overview ofDistributed Computing (Network Computing)
5
Virtual Fish Tank
“Most people grow up with a 'centralized mindset,' assuming that organized patterns can be created only by centralized control. The VFT exhibit helps people move beyond the centralized mindset, giving them a chance to create and participate in an artificial ecosystem -- and learn how patterns can, in fact, arise from decentralized interactions.”- Michael Resnick, MIT Media Lab
Things - 1014
Computers 108
Embedded Computers
1011
Desktops
TransfersTransfers TransactionsTransactions ContentContent Telemetry Telemetry ControlControl
Clients
Functions
Organization
Protocols
Waves of Network Computing
IP v6IP v4 IP Layer
SwitchesSwitches
PackagesPackages
ThermostatsThermostats
ClothesClothesPhonesPhones
TVsTVsCarsCars
GamesGames
Things - 1014
Computers 108
Embedded Computers
1011
Desktops
Client/Server
Web ApplicationsWeb Applications
Web Web ServicesServices
FractalFractal
PolyarchicalPolyarchical
N-tier
FTPTelnet
HTTPXRPC/XDR
SMTP
Clients
Functions
Organization
Protocols
SOAPSOAPRMI/IIOPRMI/IIOP
JiniJiniIdentityIdentity
UDDIUDDI
LDAPLDAP
JXTAJXTA
Waves of Network Computing
IP v6IP v4 IP Layer
PhonePhoness
TVsTVsCarsCars
GamesGames
SwitchesSwitches
PackagesPackages
ThermostatsThermostats
ClothesClothes
TransfersTransfers TransactionsTransactions ContentContent TelemetryTelemetry ControlControl
Platform EvolutionCatchCatchPhrasePhrase
The NetworkThe NetworkIs the Is the
ComputerComputer ObjectsObjectsLegacy to Legacy to the Webthe Web
The Computer The Computer Is theIs the
NetworkNetwork
Network of Network of Embedded Embedded
ThingsThingsNetworkNetworkof Thingsof Things
ScaleScale
When/PeakWhen/Peak
LeafLeafProtocol(s)Protocol(s)
DirectoryDirectory(s)(s)
SessionSession
100s100s 1,000s1,000s 1,000,000s1,000,000s 10,000,000s10,000,000s 100,000,000s100,000,000s 100,000,000100,000,000ss
1984/19871984/1987 1990/19931990/1993 1996/19991996/1999 2001/20032001/2003 1998/20041998/2004 2004/20072004/2007
XX XX +HTTP+HTTP(+JVM)(+JVM)
+XML+XMLPortalPortal +RMI+RMI UnknownUnknown
NS, NS+NS, NS+ +CDS+CDS +LDAP(*)+LDAP(*)+UDDI+UDDI
+ebXML +ebXML reg/repreg/rep
+Jini +Jini Lookup Lookup serviceservice
+?+?
RPC, XDRRPC, XDR +CORBA+CORBA +CORBA,+CORBA,RMIRMI
+SOAP,+SOAP,XMLXML +RMI/Jini+RMI/Jini +?+?
SchematicSchematic
Design Patterns
Client-Server 3-Tier
Web Application
Web Services
HybridP2P Fractal
10
Three Laws of Computing Moore's Law
Computing power doubles every 18 months
Gilder's LawNetwork bandwidth capacity doubles
every 12 months Metcalfe's Law (Net Effect)
Value of network increases exponentially as number of participants increases
11
Public Internet
Corporate Internet
Firewall
WorkgroupServer
WebServerTelco
Server
Pager
Cell Phone
Thin Client
Thin Client
PDA
NT Workstation
Solaris™
Workstation
Solaris Workstation
VideoServer
Current Enterprise Reality
12
What is a distributed system?
A collection of processes/processors that do not share memory or a clock
13
Why Distributed Systems?
Resource sharing Higher performance Flexible Reliable Scalable Cheaper Manage’able (it depends)
14
Characteristics of Distributed Systems Complex programming Heterogeneous
Hardware, OS, networking behavior, object model, programming language
Inherent problemsNetwork latencyConcurrency issuesPartial Failure
15
7 Fallacies of Distributed Computing The network is reliable Latency is zero Bandwidth is infinite The network is secure Topology doesn't change There is one administrator Transport cost is zero
16
Terminology
Naming and TransparencyLocation transparency Location Independence
Stateful vs. Stateless Failure Detection and Recovery
ReplicationLog based Recovery
Parameter Marshaling/Unmarshaling
17
Distributed Coordination
Mutual Exclusion Atomicity Concurrency Control Deadlock Handling Election Algorithms Transaction
2 phase commit
18
Distributed Systems
Evolution
RPC (procedural)
ORB(object based)
80s
RMI(object oriented)
90s
19
Early Distributed Systems
RPCDCE, ONC
Distributed File Systemsexample - NFS, SMB
Databasesexample - Oracle
Transaction Processing Monitorsexample - CICS
20
At the root of it all ...
SocketsSocket, ServerSocket, SocketImpl classes
UsesData compressionmulticastcustom protocols, etc.
JDBC
22
What is JDBC?
Java APIs for manipulating relational databases
Uses standardized SQL
23
JDBC Architecture
MS SQL
SPISybasedriver
DB2driver
Oracledriver
JDBC Driver Manager
BridgeODBC
Sybase DB2 Oracle
Java application Java application
JDBC API
24
A 2-tier Example
Database
Database
Frontend
Frontend
Frontend
JDBC
25
JDBC Status
Core API in JDK 1.1 onwards JDBC 3.0 Core and Extension API
currently available JDBC drivers available for wide-range
relational databases
26
JDBC Resources
Java Packagesjava.sqljavax.sql
Websites java.sun.com/products/jdbc
BooksDatabase Programming with JDBC and
Java by George E. Reese, George H. Reese
RMI (Remote Method Invocation)
28
What is RMI?
New Distributed system paradigm Natural extension of the OO paradigm Seamless integration of objects (objects
everywhere) Allows method invocation across JVM
boundaries Can pass or receive objects to/from
remote object Code moves with the object (code movement)
Distributed garbage collection Activation
29
A 3-tier Example
Database
Database
Frontend
Frontend
Frontend
Business Logic
RMI JDBC
30
RPC Architecture (General)
ClientProxy
ServerProxy
Wire
The proxies deal with parameter marshaling/unmarshaling
31
RMI Architecture
JavaClient
Stub
JavaServer
Skeleton
The Stubs/Skeletons deal with Serializing/De-serializing
JRMP
32
Class Loading
RMI loads classes if not available locallyRemote object, stub, skeleton, parameter
and return value classes Loaded classes subject to installed
security manager
ClientServer
Lookup
Remote Reference + stub code
33
Object Serialization
Used for passing objects by value Write/read objects and graphs of objectsLightweight PersistenceObjects are converted into byte streamsCustomization on a per-class basis is
possible
34
RMI Development Process
Four step development Define the interfaces to your remote
objects Implement the remote objects Run rmic on remote implementation
classes Make code network-accessible
35
RMI Deployment
rmiregistryProvides a bootstrap service to locate the
first server object Start the server Start the client
36
RMI Status
Core since JDK 1.1 New Features in JDK 1.2
Activation Custom socket types API enhancements Performance improvements
37
Customer Feedback
Many customers like RMI: Easy to program No need to learn separate IDL Supports full Java programming language
semantics (value objects) Ideal for communication between Java
applications
38
Customer Feedback (Cont’d)
Many customers like CORBA: Standardizing on CORBA IDL and IIOP Multi-vendor Cross-language Allows communication between Java
applications and C++ Common input: Why not RMI over
IIOP?
39
RMI over IIOP
RMI over IIOP supports a large subset of JDK 1.1 RMI API over CORBA IIOP
Joint work between: IBM, Netscape, Oracle, Sun, Visigenic
With input from many other partners
40
RMI over IIOP
41
RMI over IIOP (Simplified)
Java ClientORB
AnyServerORBIIOP
The ORBs deal with parameter marhalling/unmarshalling
42
RMI over IIOP Features
True subset of RMI over JRMP Uses CORBA objects-by-value
extension Allows genuine interoperability with
C++ and other languages RMI over IIOP combines:
RMI style ease of use plus cross-language interoperability
No Distributed Garbage Collection
43
What is Java IDL
Java IDLUses OMG's Java Language Mapping Layered on Internet Inter ORB Protocol
(IIOP) Generates Portable Stubs/Skeletons
44
Java IDL Development
45
Java IDL runtime
XML
47
Language Description Pros consSGML Language for
describingdocuments
Completeandextensible
Complex
HTML HyperTextMarkupLanguage
Simple Focus onrendering;Not Extensible
XML eXtensibleMarkupmetaLanguage
Simple,extensible
Need othertechnologiesin conjunction
What Is XML?
eXtensible Markup metaLanguage Universal Data description
mechanism
48
XML and Java Technology
Complementary technologiesXML is portable reusable dataJava Technology is portable behavior
Both are Web-friendly, open, vendor neutral, Unicode support
49
What is Needed?
XML “Basic Plumbing” classes:Ability to parse XML:
Parser(s) SAX DOM Namespaces Support in parser(s)
50
XML Schema
XML = Data without syntax? Schemas specifies syntax of XML
documentDTDXML schema
J2EE
52
What Is the Java™ 2 Platform, Enterprise Edition (J2EE)?
Open and standard based platform for
developing, deploying and managing n-tier, Web-enabled, server-centric
enterprise applications
53
The Java™ 2 Platform
High-EndServer
Java TechnologyEnabled Desktop
WorkgroupServer
Java TechnologyEnabled Devices
54
What Do You Get from J2EE?
API and Technology specifications Development and Deployment
Platform Reference implementation Compatibility Test Suite (CTS) J2EE BluePrints
55
J2EE 1.3APIs and Technologies
Java 2 SDK, Standard EditionRMI/ IIOP
JDBC™ Java Messaging Service
JNDIServlet
JavaServer Pages™JavaMail
JavaBeans™ Activation FrameworkEnterprise JavaBeansJava Transaction API
Java Transaction ServiceConnector Architecture
ECPerf™
Version1.31.03.0
1.0.2b 1.2.1
2.31.21.2
1.0.12.0
1.0.11.11.01.0
56
What is EJB Technology?
Cornerstone of J2EE A server-side component technology Easy development and deployment of
Java technology-based application that are:Transactional, distributed, multi-tier,
portable, scalable, secure, …
57
Why EJB Technology?
Leverages the benefits of component-model on the server side
Separates business logic from system code
Provides framework for portable components Over different J2EE-compliant servers Over different operational environments
Enables deployment-time configurationDeployment descriptor
58
EJB Architecture
59
What is a Servlet?
Java™ objects which extend the functionality of a HTTP server
Dynamic contents generation Better alternative to CGI, NSAPI,
ISAPI, etc.EfficientPlatform and server independentSession managementJava-based
60
Servlets vs. CGI
CGIBased
Webserver
CGIBased
Webserver
Request CGI1Child for CGI1
CGIBased
Webserver
Servlet Based Webserver
JVM
Request CGI1Child for CGI1
Request Servlet1
CGIBased
Webserver
Servlet Based Webserver
JVMServlet1
Request CGI1Child for CGI1
Request CGI2
Request Servlet1
CGIBased
WebserverChild for CGI2
Servlet Based Webserver
JVMServlet1
Request CGI1Child for CGI1
Request CGI2
Request Servlet1
Request Servlet2
CGIBased
WebserverChild for CGI2
Servlet Based Webserver
JVMServlet1
Servlet2
Request CGI1Child for CGI1
Request CGI2
Request CGI1
Request Servlet1
Request Servlet2
CGIBased
WebserverChild for CGI2
Child for CGI1
Servlet Based Webserver
JVMServlet1
Servlet2
Request CGI1Child for CGI1
Request CGI2
Request CGI1
Request Servlet1
Request Servlet2
Request Servlet1
CGIBased
WebserverChild for CGI2
Child for CGI1
Servlet Based Webserver
JVMServlet1
Servlet2
Request CGI1Child for CGI1
61
01 public class ExampleServlet extends HttpServlet {02 public void doGet(HttpServletRequest request,03 HttpServletResponse response)04 throws ServletException, IOException05 {06 response.setContentType(“text/html”);07 PrintWriter out = response.getWriter();08 out.println(“Good Day USA!<BR>”);09 Date rightNow = new Date();10 out.println(“The time is: “ + rightNow);11 }12 }
Code for a Simple Servlet
62
What is JSP Technology?
Enables separation of business logic from presentationPresentation is in the form of HTML or
XML/XSLTBusiness logic is implemented as Java
Beans or custom tagsBetter maintainability, reusability
Extensible via custom tags Builds on Servlet technology
63
Big Picture
HTTP(S)HTTP(S)HTML/XMLHTML/XML
Client
64
JSP
Servlets and JSP - Comparison
HTML code in Java
Any form of Data Not easy to author Underlying
semantics
Java-like code in HTML
Structured Text Very easy to author Code is compiled
into a servlet
Servlets
65
JTS/JTA (Transaction Processing)
Distributed transaction processing JTS: Mapping to CORBA Object
Transaction Service (OTS)Access to standard object transaction
coordinationWho: IBM, Inprise, Bull, WebLogic
JTA: API for transactionsJava interface to transactional systemsWho: Transaction/DB server vendors
66
•JNDI (Naming and Directory)
JNDI: Java Naming and DirectoryUnified field theory for namingLDAP, NIS, NIS+, DNS, File, etc. Industry supportBenefits:
Single interface to enterprise network objects Cross platform
67
JMS (Messaging and Pub/Sub)
JMS: Java Message Service APIAsynchronous communicationsPublish and SubscribeReliable QueuesGuaranteed deliveryBenefits:
Single interface to MOM Open and cross platform
Who: TIBCO, IBM, Modulus, Active
68
Java 2 Platform, Enterprise Edition API and Technology specifications Development and Deployment
Platform Reference implementation Compatibility tests with branding J2EE BluePrints
69
Platform Value to Developers
Unified platform Choice of platform implementation
PerformanceScalabilityReliabilityManageabilityTools
Increased productivity Portability of code Ready-to-use security framework
70
Client
Client
Client
Client
Client
ClientTier
Enterprise Information
TierMiddle
Tier
Enterprise Information
Systems (EIS):RelationalDatabase,Legacy
Applications,ERP Systems
Enterprise JavaBeans™
Enterprise JavaBeans
Other Services:JNDI, JMS,JavaMail™
J2EEApplication
Server
Web ServerJSP,
Servlets
Firewall
J2EE is End-to-End Solution
HTML/XML
71
JND
I
J2SE
JMS
RM
I/IIO
P
JDB
C
Database
AppClient
App Client Container
HTTP/HTTPS
J2SE
RMIJ2SE
JND
I
JMS
RMI/I
IOP
JDB
C
JTA JavaMail
JAF JND
I
JMS
RMI/I
IOP
JDB
C
JTA
JavaMail
JAF
HTTP/HTTPS
Applet Container
Applet JSP Servlet EJB
Web Container EJB Container
RMI
J2SE
J2EE Containers & Components
72
ComponentsHandle
Containers and Components
Concurrency Security Availability Scalability Persistence Transaction Lifecycle
management Management
Presentation Business Logic
ContainersHandle
73
Creation Assembly Deployment
Created by Component Developer
Assembledand Augmentedby Application
Assembler
Processed by Deployer
Deploy
EnterpriseComponents
J2EE Container
J2EE APPJ2EE Modules
Lifecycle illustration
74
Java 2 Platform, Enterprise Edition API and Technology specifications Development and Deployment
Platform Reference implementation Compatibility Test Suite (CTS) J2EE BluePrints
75
What and Why a Reference Implementation? Validates specification Fully-compliant Fully-functional Not commercial quality
ScalabilityPerformance
Use it for prototyping J2EE based applications
76
Compatibility Test Suite (CTS)
Ultimate Java™ technology mission:Write Once, Run Anywhere™My Java-based application runs on any
compatible Java virtual machinesMy J2EE based technology-based
application will run on any J2EE based Compatible platforms
77
J2EE BluePrints
Best practice guidelines, design patterns and design principlesMVC pattern
Covers all tiersClient tierWeb tierBusiness logic (EJB) tierDatabase access tier
Sample codeJava Pet Store
78
Summary
Java is unifying the fragmented distributed systems arena
The ability to be able to move code makes Java unique
Java is able to inter-operate with legacy applications