• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Combining AJAX and WSRF for Web-browser based Grid clients

Combining AJAX and WSRF for Web-browser based Grid clients






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Combining AJAX and WSRF for Web-browser based Grid clients Combining AJAX and WSRF for Web-browser based Grid clients Document Transcript

    • Combining AJAX and WSRF for Web-browser based Grid clients Arjun Sen, John Brooke, Bruno Harbulot, Mark Mc Keown, Stephen Pickles and Andrew Porter sena AT cs.man.ac.uk and {john.brooke, bruno.harbulot, mark.mckeown, stephen.pickles, andrew.porter} AT manchester.ac.uk The University of Manchester, Oxford Road, Manchester M13 9PL, United Kingdom November 2006 Abstract puter simulations of one form or another in order to investigate the behaviour of different systems. This paper demonstrates the effectiveness of The size of these simulations frequently necessi- combining Asynchronous Javascript and XML tates the use of High Performance Computing re- (AJAX) and the Representational State Trans- sources which are increasingly being made avail- fer (REST) architectural style with the Web able as a part of Grids such as the National Grid Service Resource Framework (WSRF) standard. Service,2 in the United Kingdom, and the Tera- Accessing WS-Resources (according to WSRF) Grid,3 in the United States. in a manner compatible with the REST princi- The project described in this paper provides ples, using a Web browser, makes it possible to a light-weight client for interacting with WS- provide a light-weight, portable client for inter- Resources (see Section 2.1) using only a Web acting with scientific simulations in distributed browser, via the use of AJAX techniques (see computing environments, with similar function- Section 2.4) and REST principles (see Sec- ality to pre-existing platform-specific clients that tion 2.2). The RealityGrid use-case and refer- required a full installation procedure. This pa- ence implementations are presented in Section 3. per describes this client and emphasises which Section 4 presents in detail the AJAX-based Re- standards and principles of distributed comput- alityGrid client, before Section 5 concludes. ing have played a key role in putting this appli- cation together. 2 Underlying technologies and concepts 1 Introduction This section presents the technologies and con- This paper demonstrates the effectiveness of cepts that have been utilised throughout this combining AJAX and REST with WSRF by project. First, the Web Service Resource Frame- looking at their use within the RealityGrid1 work, which has been used to implement compu- project. RealityGrid facilitates the study of com- tational steering in RealityGrid, is presented in plex condensed-matter systems through the use Section 2.1. Then, the REST architectural style of Grid technology. The majority of the phys- is presented in Section 2.2. Finally, two sets of ical scientists involved in the project use com- 2 http://www.grid-support.ac.uk/ 1 3 http://www.realitygrid.org/ http://www.teragrid.org/ 1
    • technologies used in Web browsers are described: usable according to the principles of REST, as XSLT and AJAX, in Sections 2.3 and 2.4, respec- described in the following section. tively. 2.2 Representational State Transfer 2.1 Web Service Resource Framework (REST) (WSRF) Representational State Transfer (REST ) [Fie00, The Web Service Resource Framework (WSRF) Chap. 5] is an architectural style for building is a set of OASIS standards4 for modelling state- large-scale distributed systems. It consists of ful entities using Web services [FFG+ 04]. Within a set of principles and design constraints which WSRF, a WS-Resource is defined as “the com- were used in designing the protocols that make position of a resource and a Web service through up the World Wide Web [JW04]. which the resource can be accessed ” [GKM+ 06]. REST is based on a client-server model which A resource is defined in WSRF as a logical entity supports caching and where interactions between that has the following characteristics: it must be client and server are stateless; all interaction identifiable, it must have a set of zero or more state is stored on the client for server scalability. properties, which are expressible in XML infoset, The concept of a resource is central to REST. and it may have a lifecycle [GKM+ 06]. Unfor- Resources have an identity and anything that tunately, as presented in Section 2.2, the word can have an identity can be a resource. Re- “resource” has a different definition in REST. sources are manipulated through their represen- The concept of a resource within WSRF is tations and are networked together through link- an abstract one and does not necessarily have ing — hypermedia is the engine of application to map to a real physical resource. For ex- state. Together, the last set of constraints com- ample, a WS-Resource could be used to model bine to make up the principle of uniform inter- a physical object such as a printer or some- face. REST also has an optional constraint for thing more abstract like a computer simula- the support of mobile code. tion. The set of properties of a WS-Resource HTTP [FGM+ 99] is an example of a protocol is expressed in the ResourcePropertyDocument, that has been designed according to REST. On which is a projection of the state of the re- the World Wide Web a resource is identified by a source (written in XML). These properties, URI [BLFM05] and clients can retrieve a repre- called ResourceProperties, can be accessed via sentation of the resource using an HTTP GET.7 Web service operations defined by the WSRF HTTP can also supply caching information along specifications [GT06]; in particular, a property with the representation to allow intermediaries can be queried and, when the WS-Resource per- to cache the representation. The representation mits it, inserted or updated. WS-Addressing5 may contain links to other resources creating a EndpointReferences (EPR), are used for address- network of resources. Clients can change the ing WS-Resources. representation of a resource by replacing the ex- The implementation of WSRF that has been isting representation with a new one, for exam- used throughout this project is WSRF::Lite,6 ple using an HTTP PUT. All resources on the which is written in Perl. The main particular- World Wide Web have a uniform interface al- ity of WSRF::Lite is that, whilst conforming to lowing generic pieces of software such as Web the WSRF standard, it is also designed to be browsers to interact with them. Web servers are also able to send code, for example Javascript 4 http://www.oasis-open.org/committees/wsrf 5 7 http://www.w3.org/Submission/ws-addressing/ HTTP GET is the default action performed by Web 6 http://www.sve.man.ac.uk/Research/AtoZ/ILCT browsers when a URI is entered. 2
    • (see Section 2.4), to the client to be executed 2.4 Asynchronous Javascript and within the browser. XML (AJAX) WSRF::Lite supports REST in that: (a) it uses only the address part of an EPR for Asynchronous Javascript and XML (AJAX ) is a identifying a WS-Resource — there is a di- technique for developing interactive Web sites. rect mapping between EPRs in WSRF and AJAX is not a technology in itself, rather it URIs in the REST style — and (b) it maps is the combination of a number of technolo- certain WSRF operations to HTTP methods. gies: DOM, HTTP and Javascript.8 AJAX al- GetResourcePropertyDocument maps to HTTP lows a Web browser to update parts of a Web GET, PutResourcePropertyDocument maps to page asynchronously by communicating with a HTTP PUT and Destroy maps to HTTP Web server using Javascript. Javascript is a DELETE. For example, an HTTP GET on client-side scripting language for Web browsers. an HTTP URI from the address element of Most modern graphical Web browsers are capa- an EPR of a WS-Resource in WSRF::Lite re- ble of executing Javascript scripts that are em- turns the ResourcePropertyDocument for the bedded into webpages. Example applications of WS-Resource. Similarly an HTTP PUT on the Javascript are: raising and re-dimensioning pop- same URI will replace the ResourceProperty- up windows, changing an image when pointing Document and an HTTP DELETE will de- the mouse cursor over a zone and validating the stroy the WS-Resource. The ResourceProperty- content of a form before submission. Document returned in response to an HTTP In the traditional processing model of the GET will not be wrapped in SOAP and, if Web, entering a URI into a Web browser causes the developer includes an XSLT transformation it to execute HTTP GET [FGM+ 99] request for the WS-Resource, WSRF::Lite will auto- on the URI. The Web server hosting the URI matically include a link to the XSLT in the sends a response to the Web browser, usually ResourcePropertyDocument. an HTML document, which the browser renders and displays for the user. The content of that HTML document is analysed and elements of the 2.3 Extensible Stylesheet Language page that refer to other URIs are retrieved in Transformations (XSLT) the same manner (for example, images). This Extensible Stylesheet Language Transformations process finishes once all the elements required to (XSLT ) [ABC+ 01, XSL99] make it possible render the page have been obtained. to express the rules for the transformation The AJAX model differs from this processing of one XML document format into another. model in that it makes it possible to update a Modern Web browsers include XSLT engines page or some of its elements asynchronously. An to perform these transformations upon re- HTML document can contain Javascript, or a ceipt of an XML document. Typically, this link to a Javascript document defining various is specified in the original XML document by routines, which the browser may execute. The including an XML processing instruction con- 8 taining a reference to an XSL stylesheet (of the The term Javascript is used in this article to en- compass all the variants of the language: the origi- form “<?xml-stylesheet type="text/xsl" nal Netscape JavaScript (which has now become Mozilla href="URI-of-stylesheet"?>”). JavaScript [moz06]), Microsoft JScript and the standard- XSLT is used in the context of this project ised ECMAScript [ECM99]. Most differences between to transform XML documents as returned by these dialects are minor; they may cause implementation issues for compatibility between browsers, thus develop- WS-Resources into XHTML documents, which ers are encouraged to test their Javascript code on mul- are Web-pages ready to be rendered by Web tiple platforms. The main browser used throughout this browsers. project has been Firefox. 3
    • Javascript can use XMLHTTPRequest9 to commu- tools for performing steering on both local and nicate with a Web server, for example to retrieve remote simulations, potentially in collaboration data to update part of the Web page. Because with others. In a Grid context, it is the ability to only a part of the page is updated the whole steer remote simulations that is of importance. page does not have to be re-rendered, improv- The RCSS implements this functionality using ing the user experience. The Javascript does WSRF as implemented in WSRF::Lite. not block when sending or receiving data using The architecture of the system is shown in XMLHTTPRequest, allowing the browser to con- Figure 1 and consists of four principal compo- tinue processing the Web page; therefore, AJAX nents: the steered simulation built against the is useful for creating Web pages that need to poll RealityGrid steering library, the Steering Web servers. XMLHTTPRequest can also be used to Service (SWS), the Registry and the Steering send data to the Web server. Client. The Registry is implemented as a WS- ServiceGroup (part of the WSRF standard) and is hosted in a WSRF::Lite Container. The SWS 3 Use-case: RealityGrid Com- is implemented as a WS-Resource and is also putational Steering System hosted in a WSRF::Lite Container (which may be the same as that of the Registry). The sim- This section presents the use-case which has ulation communicates with the SWS using the motivated the RealityGrid project. Tradition- RealityGrid steering library which in turn uses ally, a scientist runs large-scale simulations non- the gSOAP toolkit10 to perform SOAP messag- interactively. A text file describing the initial ing. conditions and parameters for the simulation is The SWS effectively provides a Web ser- prepared. Then, the simulation is submitted to a vice interface to the steerable simulation with batch queue, waiting until there are sufficient re- the majority of the functionality provided sources available for it to be executed. The sim- through standard WSRF operations such as ulation runs entirely according to the prepared GetResourceProperty and SetResourceProperty input file and outputs the results to disk for the (Section 2.1). This Web service interface has user to examine later. made it possible to construct a variety of steering This technique is suitable for some forms of clients. These include a desktop steering client investigation, but for others it can lead to a very which enables the user to connect to multiple inefficient use of resources. A solution to this simulations simultaneously, as well as displaying problem is to provide the scientist with a way (continuously updating) plots of parameter val- to interact with the simulation while it is run- ues. A client based upon the Microsoft .NET ning — a process that is called “computational framework has also been developed for PDA steering” [MvWvL99]. This may be as simple as and Smartphone platforms [HK06]. Finally, a allowing the user to monitor the values of some Web-portal based steering client [BEG+ 05] has parameters in the simulation and, if necessary, to also previously been developed using the Grid- edit the values of other parameters. However, to Sphere11 framework. This provides some of the aid the scientist in making informed decisions, functionality of the desktop client but does not it is often necessary to make it possible to see refresh the values automatically. Of all the steer- a visualisation of some aspect of the simulated ing clients mentioned so far, this is perhaps the system as it evolves. most convenient from a user perspective due to The RealityGrid Computational Steering Sys- the removal of the need to install any software — tem (RCSS) [PHPP05] provides a scientist with 10 http://gsoap2.sourceforge.net/ 9 11 http://www.w3.org/TR/XMLHttpRequest/ http://www.gridsphere.org/ 4
    • WSRF::Lite Container Registry find publish Steering steered values Steering WSRF::Lite Client updates Web Service Container polling steered values updates polling Steering Library Simulation Figure 1: Architecture of the WSRF-based RealityGrid Computational Steering System. a Web browser is all that is required. However, it XML document includes a processing instruc- requires user interaction for updating and, from tion containing a link to the XSLT stylesheet a server administration point of view, the instal- (see Section 2.3) for the SWS ResourceProperty- lation of the required GridSphere environment is Document. quite an overhead to deployment. Once the XSLT stylesheet is also retrieved, the The next section presents the AJAX-based Web browser uses it to transform the XML of the client that circumvents these limitations. ResourcePropertyDocument into an XHTML document which is rendered by the Web browser (as shown in Figure 3, for example). Clients that 4 The RealityGrid AJAX client are not Web browsers, or clients that do not un- This section provides a detailed description of derstand XSLT, may ignore the XSLT transfor- the RealityGrid AJAX steering client to show mation. how AJAX, REST and WSRF can be combined. Embedding the XSLT stylesheet in the re- The overall architecture of the system is illus- trieved ResourcePropertyDocument causes the trated in Figure 2. transformation to happen on the client-side. A RealityGrid user wishing to attach to a run- However, the same result could be achieved by ning simulation enters the URI from the address applying the transformation on the server-side, element of the EPR of the SWS (which may be and HTTP is able to provide support for this obtained by querying the Registry — Figure 1) through content negotiation. in the location field of the Web browser. This The XSL transformation is sufficient to extract triggers an HTTP GET on this URI, performed parameter values from the ResourceProperty- by the Web browser. The WSRF::Lite Container Document and display a representation of them hosting the SWS responds by returning the in an attractive fashion, however it is only a ResourcePropertyDocument of the SWS. This static representation. AJAX enables the Web 5
    • Browser WSRF::Lite Container Polling (HTTP GET) ResourcePropertyDocument JavaScript Steering command (HTTP POST) SWS updates updates events XHTML SVG CSS Figure 2: Architecture of the AJAX-based steering client and Steering Web Service. Figure 3: Screenshot of the Control Panel of the Web Steering Client displayed in Firefox. 6
    • browser to modify parts of the XHTML docu- has four sections: Monitored (read-only) ment without reloading the whole page. As in- Parameters, Steered (writable) Parameters, dicated in Figure 2, the XHTML document con- Data IO and Checkpoint Types. tains a reference to a Javascript file and makes use of the functions defined therein to provide • Plot Panel: this panel is managed almost functionality beyond that of displaying the val- entirely by Javascript methods for drawing ues of key ResourceProperties. This includes the plots based on the data displayed in the ability to perform automatic polling of the WS- Steering Panel (particularly “Monitored Pa- Resource for updating the Web page and par- rameters”). This is discussed below. tial user-triggered updates of the WS-Resource’s • Debug Panel: developing a relatively com- properties. plex application in Javascript is difficult The polling is performed by a Javascript func- due to the lack of debugging tools; this tion invoked at regular intervals (the duration of panel allows debugging output to be dis- the interval can be controlled by the user). This played and also incorporates a text area in function performs an HTTP GET request on the which the most recent XML exchanged be- WS-Resource, but the processing of the result is tween XMLHTTPRequest and the SWS may performed within the function, so as to update be viewed. only the relevant parts of the XHTML document being displayed by the browser. • Navigation bar: this is a part of the interface In addition to the automatic updates, with buttons to switch between each of the Javascript enables the implementation of graph- panels mentioned above. ical widgets such as panels and buttons that can be used to build a Graphical User Inter- In addition to the ability to poll the SWS and face (GUI). This GUI enables the user to interact thus monitor the parameter values of the simula- with and change the values of properties of the tion, a steering client must also permit the user WS-Resource. to change the values of (steerable) parameters. The ResourceProperties of an SWS can be di- In this steering client, a SOAP message contain- vided into two categories: (1) meta-data describ- ing a SetResourceProperty call is constructed ing the SWS and the simulation including in- and sent using the Javascript XMLHTTPRequest formation such as the TerminationTime of the via an HTTP POST. It is therefore possible SWS and the name of the running application, to update the ResourceProperties of the SWS and (2) data and parameters pertaining to the which in turn results in the steered simulation simulation being steered. From these two cate- picking up new parameter values from it. gories, the user interface was designed to have This approach was taken here because the four separate “panels” and a navigation bar: SWS does not yet implement the SetRe- sourcePropertyDocument method. Once that • Control Panel: this panel enables the user method is implemented, it will be possible for to control the Web Steering Client itself as the steering client to simply do an HTTP well as to send generic commands (such as PUT of the XML containing the updated detach or stop) to the steered simulation. ResourceProperty — there will be no need to It displays the meta-data derived from the construct a SOAP message. ResourcePropertyDocument of the SWS — Previous experience with other steering clients see Figure 3. has shown that users find the ability to view plots of parameter histories very useful, particularly • Steering Panel: this panel is similar to that due to the feedback they can provide on steer- of our original desktop steering client. It ing activity. This function is provided in this 7
    • Figure 4: Screenshot of the Plot Panel displayed in Firefox. client through a combination of Javascript and approach to creating Grid clients. It provides Scalable Vector Graphics (SVG).12 Javascript a bridge between the world of Grid computing code logs the parameter values obtained through that extensively uses WSRF and the World Wide polling the SWS and constructs a plot using Web. For the RealityGrid project the advan- SVG. Figure 4 shows an example obtained by tages of the AJAX client are clear: users re- monitoring the system temperature in a Molec- quire only a Web browser and no longer need ular Dynamics simulation of crystalline Silicon. to install client software, clients and services can At a SEQUENCE NUM of approximately 6400 be updated without danger of version mismatch the target temperature is steered from a value of between server and client, and the RealityGrid 1500K up to a value of 2000K. The response in steering client can be integrated into Mashups.13 the system temperature can be seen in the plot. Another important factor for RealityGrid was Security is supported using X509 [HFPS99] that it did not require any modifications to the certificates and Transport Layer Secu- existing code base implemented for WSRF::Lite; rity [DA99]. The user imports his X509 all that was required was the creation of XSLT certificate into the Web browser and the and Javascript files to be included in the de- browser uses it for mutual authentication ployed installation of WSRF::Lite. with the WSRF::Lite Container over a secure Future work will include supporting the HTTPS [Res00] connection. caching facilities of HTTP. This will allow the client to use conditional GET so that it will only 5 Conclusions receive a new set of ResourceProperties if they have changed since the last retrieval, thus reduc- The paper has illustrated that combining AJAX and REST with WSRF can be a very effective 13 http://www-128.ibm.com/developerworks/ 12 http://www.w3.org/Graphics/SVG/ library/x-mashups.html 8
    • ing the network load and the client processing jkowski, Don Ferguson, Frank overhead. Leymann, Martin Nally, Igor Sedukhin, David Snelling, Tony Storey, William Vambenepe, and References Sanjiva Weerawarana. Modeling [ABC+ 01] Sharon Adler, Anders Berglund, stateful resources with web ser- Jeff Caruso, Stephen Deach, Tony vices, May 2004. http://www-128. Graham, Paul Grosso, Eduardo ibm.com/developerworks/ Gutentag, Alex Milowski, Scott library/ws-resource/ Parnell, Jeremy Richman, and ws-modelingresources.pdf. Steve Zilles. Extensible Stylesheet [FGM+ 99] Roy T. Fielding, Jim Gettys, Language (XSL) Version 1.0. Oc- Jeffrey C. Mogul, Henrik Frystyk tober 2001. http://www.w3.org/ Nielsen, Larry Masinter, Paul J. TR/xsl/. Leach, and Tim Berners-Lee. [BEG+ 05] Mark G. Beckett, Matthew D. Hypertext Transfer Protocol – Egbert, Paul J. Graham, Kevin HTTP/1.1. June 1999. http:// Stratford, and Jean-Christophe www.ietf.org/rfc/rfc2616.txt. Desplat. The realitygrid steering portal. In Proceedings of the [Fie00] Roy Thomas Fielding. Architec- UK e-Science All Hands Confer- tural Styles and the Design of ence, Nottingham, 2005. http: Network-based Software Architec- //www.allhands.org.uk/2005/ tures. PhD thesis, University of proceedings/papers/484.pdf. California, Irvine, 2000. http: //www.ics.uci.edu/∼fielding/ [BLFM05] Tim Berners-Lee, Roy T. Field- pubs/dissertation/top.htm. ing, and Larry Masinter. Uniform Resource Identifier (URI): Generic [GKM+ 06] Steve Graham, Anish Karmarkar, Syntax. January 2005. http:// Jeff Mischkinsky, Ian Robin- www.ietf.org/rfc/rfc3986.txt. son, and Igor Sedukhin, editors. Web Services Resource 1.2 (WS- [DA99] T. Dierks and C. Allen. The TLS Resource). Organization for the Protocol. January 1999. http:// Advancement of Structured Infor- www.ietf.org/rfc/rfc2246.txt. mation Standards (OASIS), April [ECM99] ECMA. ECMA-262: ECMAScript 2006. http://docs.oasis-open. Language Specification. ECMA org/wsrf/wsrf-ws resource-1. (European Association for Stan- 2-spec-os.pdf. dardizing Information and Com- munication Systems), third edi- [GT06] Steve Graham and Jem Tread- tion, December 1999. http: well, editors. Web Services //www.ecma-international. Resource Properties 1.2 (WS- org/publications/standards/ ResourceProperties). Organi- Ecma-262.htm. zation for the Advancement of Structured Information Stan- [FFG+ 04] Ian Foster, Jeffrey Frey, Steve dards (OASIS), April 2006. Graham, Steve Tuecke, Karl Cza- http://docs.oasis-open. 9
    • org/wsrf/wsrf-ws resource properties-1.2-spec-os.pdf. [HFPS99] R. Housley, W. Ford, W. Polk, and D. Solo. Internet X.509 Public Key Infrastructure Certificate and CRL Profile. January 1999. http:// www.ietf.org/rfc/rfc2459.txt. [HK06] Ian R. Holmes and Roy S. Kalawsky. The realitygrid PDA and smartphone clients: Devel- oping effective handheld user interfaces for e-science. In Proceed- ings of the UK e-Science All Hands Conference, Nottingham, 2006. [JW04] Ian Jacobs and Norman Walsh, ed- itors. Architecture of the World Wide Web, Volume One. Decem- ber 2004. http://www.w3.org/TR/ 2004/REC-webarch-20041215/. [moz06] Core JavaScript 1.5 Refer- ence. Mozilla, August 2006. http://developer.mozilla.org/ en/docs/Core JavaScript 1. 5 Reference. [MvWvL99] J. D. Mulder, J. J. van Wijk, and R. van Liere. A survey of com- putational steering environments. Future Generation Computer Sys- tems, 15:119–129, 1999. [PHPP05] S. M. Pickles, R. Haines, R. L. Pin- ning, and A. R. Porter. A practi- cal toolkit for computational steer- ing. Philosophical Transactions of the Royal Society, A363:1843–1853, 2005. [Res00] E. Rescorla. HTTP Over TLS. May 2000. http://www.ietf.org/rfc/ rfc2818.txt. [XSL99] XSL transformations (XSLT) ver- sion 1.0, November 1999. http: //www.w3.org/TR/xslt. 10