Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 11: System Examples 5/24/2017 Distributed Systems - COMP 655 1 Distributed system examples • Commercial middleware – J2EE Overview – .NET Overview • Web services: where middleware systems meet • Web service from Open Source middleware 5/24/2017 Distributed Systems - Comp 655 2 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 – – – – 5/24/2017 Integrated Suitable for enterprise applications Widely available Includes all of the basic middleware capabilities for building distributed systems Distributed Systems - Comp 655 3 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 5/24/2017 Distributed Systems - Comp 655 4 The Java™ Platform Java Technology Enabled Devices Java Technology Enabled Desktop Workgroup Server High-End Server The 3 Cs of Java EE Components Containers Connectors 5/24/2017 Distributed Systems - Comp 655 6 J2EE Overview 5/24/2017 Distributed Systems - Comp 655 7 Key middleware services • Communication: RMI-IIOP, JMS • Naming: JNDI (part of Java SE) • Persistence: JPA, JDBC, JDO • Transactions: JTA, JTS • Security: (next page) 5/24/2017 Distributed Systems - Comp 655 8 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… 5/24/2017 Distributed Systems - Comp 655 9 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) 5/24/2017 Distributed Systems - Comp 655 10 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, … 5/24/2017 Distributed Systems - Comp 655 11 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 5/24/2017 Distributed Systems - Comp 655 12 Invoking an EJB method Home Object 3 Client 1 2 5 4 6 EJB Object JNDI NS, eg LDAP 5/24/2017 EJB Container 1. 2. 3. 4. 5. 6. 7. 7 Enterprise Bean(s) Request home object Return home object reference Request new EJB object Create EJB object Return EJB object reference Invoke method Delegate request to enterprise bean(s) Distributed Systems - Comp 655 13 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 tutorial An MDB article 5/24/2017 Distributed Systems - Comp 655 14 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 5/24/2017 Distributed Systems - Comp 655 15 Leading EJB containers • Oracle/BEA Weblogic • IBM Websphere • JBoss (open source) • GlassFish (open source) • Geronimo (open source) 5/24/2017 Distributed Systems - Comp 655 16 Deployment descriptors • Deferred binding for many of the things the bean developer need not worry about, including – – – – – 5/24/2017 Access control Transaction requirements Persistence parameters Type of bean Classes used for home and remote interfaces Distributed Systems - Comp 655 17 Deployment descriptor example <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 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> 5/24/2017 Distributed Systems - Comp 655 18 Java EE 5/24/2017 Distributed Systems - Comp 655 19 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 5/24/2017 Distributed Systems - Comp 655 20 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 5/24/2017 Distributed Systems - Comp 655 21 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) 5/24/2017 Distributed Systems - Comp 655 22 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) 5/24/2017 Distributed Systems - Comp 655 23 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 .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 5/24/2017 Distributed Systems - Comp 655 26 .NET Framework • 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 Application .NET Framework Operating System + Hardware 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 – CLR manages code execution at runtime – Memory management, thread management, etc. Common Language Runtime Operating System .NET Framework Base Class Library – Object-oriented collection of reusable types – Collections, I/O, Strings, … .NET Framework (Base Class Library) Common Language Runtime Operating System .NET Framework Data Access Layer – Access relational databases – Disconnected data model – Work with XML ADO .NET and XML .NET Framework (Base Class Library) Common Language Runtime Operating System .NET Framework ASP.NET & Windows Forms – Create application’s front-end – Web-based user interface, Windows GUI, Web services, … ASP .NET Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO .NET and XML .NET Framework (Base Class Library) Common Language Runtime Operating System .NET Framework Programming Languages – Use your favorite language C++ C# VB.NET Perl … J# ASP .NET Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO .NET and XML .NET Framework (Base Class Library) Common Language Runtime Operating System .NET Framework Common Language Specification C++ VB Common Language C# Perl Specification J# … ASP .NET Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO .NET and XML .NET Framework (Base Class Library) Common Language Runtime Operating System .NET Framework Visual Studio .NET C++ C# VB Perl … J# Common Language Specification Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO .NET and XML .NET Framework (Base Class Library) Common Language Runtime Operating System Visual Studio .NET ASP .NET .NET Framework Standards Compliance C++ C# VB Perl C# Language – Submitted to ECMA … J# Common Language Specification Web Services Web Forms Mobile Internet Toolkit Windows Web services – Forms XML, SOAP-based ADO .NET and XML .NET Framework (Base Class Library) Common Language Runtime Operating System Visual Studio .NET ASP .NET Open Language Specification XML-based data access .NET programming languages 5/24/2017 Distributed Systems - Comp 655 37 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 5/24/2017 Distributed Systems - Comp 655 38 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?) 5/24/2017 Distributed Systems - Comp 655 39 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 5/24/2017 Distributed Systems - Comp 655 40 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 5/24/2017 Distributed Systems - Comp 655 41 SOAP overview Protocols include HTTP, SMTP, TCP, MSMQ, … What’s the difference between RPC and request/ response? 5/24/2017 Distributed Systems - Comp 655 42 SOAP intermediaries 5/24/2017 Distributed Systems - Comp 655 43 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 5/24/2017 Distributed Systems - Comp 655 44 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> 5/24/2017 Distributed Systems - Comp 655 45 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> 5/24/2017 Distributed Systems - Comp 655 46 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> 5/24/2017 Distributed Systems - Comp 655 47 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> 5/24/2017 Distributed Systems - Comp 655 48 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> 5/24/2017 Distributed Systems - Comp 655 49 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> ... 5/24/2017 Distributed Systems - Comp 655 50 SOAP in HTTP 5/24/2017 Distributed Systems - Comp 655 51 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 5/24/2017 Distributed Systems - Comp 655 52 WSDL • WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedureoriented information. • http://www.w3.org/TR/wsdl • Protocol bindings described: SOAP 1.1, HTTP GET/POST, MIME 5/24/2017 Distributed Systems - Comp 655 53 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/ 5/24/2017 Distributed Systems - Comp 655 54 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 codeon-demand • A protocol that is: – – – – 5/24/2017 Client/Server Stateless Cacheable Layered Distributed Systems - Comp 655 55 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 5/24/2017 Distributed Systems - Comp 655 56 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://syscon.com/webservices/article.cfm?id=728 5/24/2017 Distributed Systems - Comp 655 57 Decisions, decisions … • Linux distribution • DBMS • Programming language • Java runtime • Java IDE • Web container • Web service container • Build environment • Testing 5/24/2017 Distributed Systems - Comp 655 58 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 5/24/2017 Distributed Systems - Comp 655 59 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. 5/24/2017 Distributed Systems - Comp 655 60 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 5/24/2017 Distributed Systems - Comp 655 61 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_re sults.asp 5/24/2017 Distributed Systems - Comp 655 62 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-ins HP is developing several plug-ins 5/24/2017 Distributed Systems - Comp 655 63 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 5/24/2017 Distributed Systems - Comp 655 64 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. 5/24/2017 Distributed Systems - Comp 655 65 More on Apache Axis Some 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. 5/24/2017 Distributed Systems - Comp 655 66 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 5/24/2017 Distributed Systems - Comp 655 67