Containers and Web Services Grid Middleware 7 David
Containers and Web Services Grid Middleware 7 David Groep, lecture series 2005 -2006
Grid Middleware VII Outline n n Why web services? Web services revisited SOAP, WS-I basic profile, encoding styles § Envelope versus body § n Containers why containers § pluggable frameworks (e. g. the GT 4 security stuff) § some leaky abstractions: file ACLs in the (Globus) RLS § n Implementing grid middleware where to put the abstractions (crunching paper stuff) § is stuff in the envelope really standard? § syntax vs. semantics of the interface § n Performance: Java, C, Python, . NET 2
Grid Middleware VII Why web services came about in grid The definition of WSRF means that the Grid and Web services communities can move forward on a common base. 3
Grid Middleware VII Web Services n WS are just one implementation of a SOA we could have done ASN. 1 over BEEP over avian carriers (which might even have been faster ) § but we don’t, to help interoperation § n Web services are basically RPC using XML § largely self-describing 4
Grid Middleware VII Web Services hints n Web Services are just a syntax § Define proper sementics and document that to make your service reuseable Match up the semantics with related services § Make sure your services are compliant § § § with relevant standards (like WS-I Basic Profile) with the chosen hosting system (GT 4) 5
WSDL Styles thanks to the EGEE WS tutorial…
Grid Middleware VII Types of WSDL SOAP binding n RPC/encoded n RPC/literal n Document/encoded n Document/literal 7
Grid Middleware VII Java method example public void my. Method (int x); 8
Grid Middleware VII RPC/Encoded WSDL <message name=“my. Method. Request”> <part name=“x” type=“xsd: int”/> </message> <message name=“empty”/> <port. Type name=“PT”> <operation name=“my. Method”> <input message=“my. Method. Request”/> <output message=“empty”/> </operation> </port. Type> Binding is RPC/encoded 9
Grid Middleware VII SOAP message <soap: envelope> <soap: body> <my. Method> <x xsi: type=“xsd: int”>value</x> </my. Method> </soap: body> </soap: envelope> 10
Grid Middleware VII Advantages/disadvantages n Advantages Simple WSDL § Operation name appears in the message § n Disadvantages Type encoding information overhead § SOAP message cannot be validated except against WSDL § 11
Grid Middleware VII RPC/Literal WSDL <message name=“my. Method. Request”> <part name=“x” type=“xsd: int”/> </message> <message name=“empty”/> <port. Type name=“PT”> <operation name=“my. Method”> <input message=“my. Method. Request”/> <output message=“empty”/> </operation> </port. Type> Binding is RPC/literal 12
Grid Middleware VII SOAP message <soap: envelope> <soap: body> <my. Method> <x>value</x> </my. Method> </soap: body> </soap: envelope> 13
Grid Middleware VII Advantages/Disadvantages n Advantages WSDL is simple § Operation name appears in the message § Type encoding information is minimal § n Disadvantages § Nearly all the definitions in WSDL so not independently validatable 14
Grid Middleware VII Document/encoded n Not implemented ! 15
Grid Middleware VII Document/literal WSDL <types> <schema> <element name=“x. Element” type=“xsd: int”/> </schema> </types> <message name=“my. Method. Request”> <part name=“x” element=“x. Element”/> </message> <message name=“empty”/> <port. Type name=“PT”> <operation name=“my. Method”> <input message=“my. Method. Request”/> <output message=“empty”/> </operation> </port. Type> 16
Grid Middleware VII SOAP message <soap: envelope> <soap: body> <x. Element>value</x. Element> </soap: body> </soap: envelope> 17
Grid Middleware VII Advantages/Disadvantages n Advantages No type encoding information § The body of the soap message is all defined in a schema and so can be validated independently § n Disadvantages WSDL is more complicated § Operation name is lost § 18
Grid Middleware VII Document/wrapped WSDL <types> <schema> <element name=“my. Method”/> <complex. Type> <sequence> <element name=“x” type=“xsd: int”/> </sequence> </complex. Type> </element> </schema> <types> <message name=“my. Method. Request”> <part name=“parameters” element=“my. Method”/> </message> <message name=“empty”/> <port. Type name=“PT”> <operation name=“my. Method”> <input message=“my. Method. Request”/> <output message=“empty”/> </operation> </port. Type> WSDL schema has a wrapper around the parameters 19
Grid Middleware VII SOAP message <soap: envelope> <soap: body> <my. Method> <x>value<x> </my. Method> </soap: body> </soap: envelope> 20
Grid Middleware VII Characteristics n n Input message has a single part Part is an element Element has the same name as the operation Element’s complex type has no attributes 21
Grid Middleware VII Advantages/disadvantages n Advantages No type encoding information § Soap body is defined in a schema – validation § Method name in the soap message § n Disadvantages § n WSDL is complicated Generally this is the best style to use. 22
Grid Middleware VII When not to use document/wrapped n Document literal wrapped style does not allow for overloading n Cannot have two elements with the same name in XML (element has to have same name as operation) n In this case you may wish to use RPC/literal so that the operation name is available. 23
Grid Middleware VII 24 SOA Editor Cape Clear SOA Editor, Cape Clear 2003 WSDL © EGEE Consortium and partners, see www. g. Lite. org
Deploying web services Containers and invocation
Grid Middleware VII Container n A framework to accept, interpret, (de-)marshall the I/O for your application or service 26
Grid Middleware VII Container n Various vendors § § § n Oracle Application Server SUN Application Server IBM Web. Sphere Apache Catalina/Tomcat Apache Axis. NET although the WS on the outside may be the same, tools and interface on the business end vary 27
Grid Middleware VII Containers n Many containers, but not all the same n Vary in what they support, e. g. , § § n Platform: JVM, . NET, Unix Language (Java, C, Python) WSDL bindings (rpc or document/literal) Security mechanisms (none or GSI) VL-e supplied container GT 4 (Axis 2. 0 -RC 2++) § § § Modified to do WS-RF, -Addressing, -Notification With GSI Security framework Almost like standard Axis 2 28
Grid Middleware VII Data structures All data structures in the language (Java, C, &c) need to be serialized Easy when you stick to: Global types (int, double, String, array etc. ) Java beans (set and get methods) Otherwise need write custom serializers § commands like WSDL 2 Java generate (amonst other things) stubs to fill with the serialization code slide source: Machiel Jansen, Vrije Universiteit Amsterdam: VL-e web services induction 2006 29
Grid Middleware VII Wrapping existing application n Define input and output of the application § n n write the appropriate WSDL Generate the Java stubs Execute application from Java Redirect the output Deploy as webservice slide source: Machiel Jansen, Vrije Universiteit Amsterdam: VL-e web services induction 2006 30
Grid Middleware VII Wrapping existing application public int run(String cmd, Writer out) throws IOException { Run. Time r = Runtime. get. Runtime(); Process p = r. exec(cmd); File. IO. copy. File(new Input. Stream. Reader(p. get. Input. Stream( )), try { p. wait. For( ); // wait for process to complete } catch (Interrupted. Exception e) { return -1; } return p. exit. Value( ); } out, true); slide source: Machiel Jansen, Vrije Universiteit Amsterdam: VL-e web services induction 2006 31
Grid Middleware VII WS Clients – 3 types Stub based (easy: use WSDL 2 Java) Service endpoint is static Dynamic proxy Service endpoint dynamically at runtime Dynamic Invocation Interface (DII) Discover services at runtime then invoke methods slide source: Machiel Jansen, Vrije Universiteit Amsterdam: VL-e web services induction 2006 32
Grid Middleware VII Clients - DII Axis user guide uses Call object (DII) in examples. WSRF and GT 4 examples uses stubs. slide source: Machiel Jansen, Vrije Universiteit Amsterdam: VL-e web services induction 2006 33
Grid Middleware VII WSRF and GT 4 uses the WSCore library. http: //www-128. ibm. com/developerworks/edu/gr-dw-gr-eclipseide-i. html Notes: GT 4 WSRF is a little different from Apache WSRF GT 4 uses GAR files and JNDI deployment. Eclipse has a GT 4 plugin… slide source: Machiel Jansen, Vrije Universiteit Amsterdam: VL-e web services induction 2006 34
Grid Middleware VII Moving into the container n GT 4 puts most of the grid elements in the container support for resource properties § support for the Auth. Z framework § information system/MDS 4 § … § n makes application service development easier if the service is independent of those features § otherwise, lots of callouts are needed as in the RLS security interface from lecture #6 § 35
Grid Middleware VII Container capabilities n Axis 1. x, x<2 § § n Axis 1. 3 § § n Like Axis 1. 3, but with grid services built-in, WS-RF support Tomcat 5, Axis 2 § § n support Document/literal still no hot deployment GT 4 § n support RPC/encoded deployment of services requires restart hot deployment of services WS-RF, WS-Notification, WS-Addressing in the pipeline somewhere Sun & Oracle Application Server § Hot deployment supported 36
Grid Middleware VII Implementation n Remember that web services are stateless § § § Model state via Resources Don’t keep running after the service invocation is complete Use database/memory based storage, not process-based state retention § § Much more friendly on the CPU Resilient to machine/VM restarts The ultimate horror scenario: R-GMA producer & consumer threads, see Concurrency P&E paper on the web 37
Using containers
Grid Middleware VII Container deployment issues n Container needs inbound connectivity to get to the services most sites & compute clusters provide only outbound connectivity how to get to the service? n proxy box inside the network perimeter n n § § n a better protocol § n unlikely that beep will ever replace http … tunnel § n needs specific site support opens a security hole in the perimeter layer on top of protocols like, e. g. , jabber, and push messages through that with a proxy box overlay network § build a ‘quasi-VPN’ for your grid, e. g. using the GCB 39
Grid Middleware VII Typical Facility topology 40
Grid Middleware VII Service Deployment Example n Farm of GT 4 containers provided on the edge of the site § § § n You cannot run a container continuously on worker nodes § § n Based on the concept of “VO Boxes” For now: login to these boxes via gsissh Not for compute-intensive work No inbound IP connectivity Resource management and utilization And you should not want to, because § § All services in a container content for CPU and (disk) bandwidth JVM does not insulate services from each other 41
Grid Middleware VII Other constraints n Worker nodes are allocated in a transient way § § § Jobs run in a one-off scratch directory No shared file system for $HOME (and if it happens to be there don’t use it!) Jobs will be queued § § § Short jobs get to run faster Small jobs get to run faster Priority depends on your VO affiliation You can connect out, but cannot listen Your job is limited in wall time 42
Grid Middleware VII Central Hosting n A hosting environment can offered on a set of edge boxes § § § n Visible from the outside world Highly monitored systems for security reasons Can talk to the ‘inside’ Requirements for deployment on the CF § § § Appropriate Auth. N/Auth. Z must be used for all services (this is available by default in GT 4) Allow for request tracability (e. g. via log files) then, these services are allowed to talk to the ‘inside’ 43
Wrapping Making the world into a service
Grid Middleware VII Some general caveats n n Re-use services Use generic services where possible § n ‘job submission service’, ‘data location srv’ Don’t over-do it § WS are not suitable for low-latency HPC or bulk file transfer n We’re not running a course on WS-RF … n Not all services (nor architectures) are mature jet § § Be prepared to make compromises … … as long as it’s in-line with long-term trend 45
Grid Middleware VII Brokered Job Submission Service n n Submit brokered jobs in JDL through WS-interface to the Matrix Resource Broker WSDL specification http: //mu 7. matrix. sara. nl/Sara. Grid. Service. LCG. wsdl For detailed info: ask Bart Heupers, SARA Future version of the basic Grid middleware will have a native WMS WS interface 46
Grid Middleware VII Defining and building Services in WS-* [See Introduction to Web Services Tutorial] 1. 2. Start with the WSDL Then, generate your interfaces • • 3. 4. E. g. with GT 4 tools or JWSDP See appropriate tutorial(s): “Technologies for Building Grids” or “Sotomajor” Fill the stubs with an implementation Deploy your services in a container EGEE NA 3 Training Home has plenty of material: http: //www. egee. nesc. ac. uk/trgmat/ 47
- Slides: 47