Title: Extending JICOS to nonJava Clients and Services
1Extending JICOS to non-Java Clients and Services
- Andy Pippin
- Masters Thesis Defense
- April 12th, 2005
2Agenda
- Introduction to Jicos
- Extending Jicos to non-Java clients
- Extending Jicos to non-Java services
- Administering a Jicos system
3What is Jicos?Introduction to Jicos
- Jicos is a Java-centric network computing
service. - Where did Jicos come from?
- SuperWeb, Javelin, CX
- What computations are suited to Jicos?
- Embarrassingly parallel computations
- Divide conquer computations
- Branch bound (e.g. traveling salesman)
4Fibonacci A Jicos hello worldIntroduction to
Jicos
- public Object execute ( Environment environment )
-
- if ( n lt 2 )
-
- return new Integer( 1 )
-
- else
-
- compute( new F( n - 1 ) )
- compute( new F( n - 2 ) )
- return( new AddInteger() )
-
5Benefits of JavaIntroduction to Jicos
- Platform independent
- Java classes run relatively securely
- Code mobility
6A Jicos SystemIntroduction to Jicos
7Benefits of JicosIntroduction to Jicos
- Ease of application development
- Tolerates faulty compute servers
- Supports adaptive parallelism
8Limitations of JicosIntroduction to Jicos
- Java centricity
- Clients must be written in Java
- Tasks (hosted computations) must be written in
Java. - The human time to start stop a Jicos system is
proportional to the number of machines in it.
9Extending JicosIntroduction to Jicos
- Non-Java clients can use Jicos tasks
- For example, a web browser
- Jicos tasks can use non-Java services
- For example, a Matlab engine
- Administration start-up tear-down
- AdminTool framework
10Agenda
- Introduction to Jicos
- Extending Jicos to non-Java clients
- Extending Jicos to non-Java services
- Administering a Jicos system
11A Typical Jicos ClientExternal Client
- public static void main( String args )
-
- // get a reference to a HSP (Host Service
Provider) - HspAgent agent new HspAgent( args0 )
- Client2Hsp hsp agent.getClient2Hsp()
-
- // login
- Environment environment new Environment(
null, null ) - hsp.login( environment )
- // compute
- int number Integer.parseInt( args1 )
- Task task new F( number )
- Integer value (Integer) hsp.compute( task
) - // logout
- Invoice invoice hsp.logout()
12Non-Java Clients
Oh... Okay!
???
RMI
XML
XML
13How It All WorksExternal Client
Task over RMI
!
!
XML over HTTP
???
!
Answer over RMI
Response over HTTP
14Incoming DataExternal Client
- XML
- The Collector uses XPath
- The XML Path Language (W3C)
- Typically used in XML transforms (XSLT)
- An HTTP ltFORMgt can be converted to XML
15Example Input FibonacciExternal Client
- HTTP header
- POST /ExternalRequest HTTP/1.1
- header
- header
- Content-Length 321
- /ExternalRequest_at_taskNamejicos.examples.external.
fibonacci.Fibonacci/ExternalRequest/Fibonacci/n1
0 - HTTP ? XML
- ltExternalRequest taskNamejicos.examples.exte
rnal.fibonacci.Fibonaccigt - ltFibonaccigt
- ltngt10lt/ngt
- lt/Fibonaccigt
- lt/ExternalRequestgt
16Collector/External ProcessorExternal Client
- The Collector extracts items from the input
- Task class name
- Response type
- Passes the rest of the input to the External
Request Processor (ERP).
17Converting the XML to JavaExternal Client
- XML
- ltExternalRequest taskNamejicos.examples.exte
rnal.fibonacci.Fibonaccigt - ltFibonaccigt
- ltngt10lt/ngt
- lt/Fibonaccigt
- lt/ExternalRequestgt
- Fibonacci.fromXml()
- Uses XPath queries
- this.n externalRequest.getValue(
- /ExternalRequest/Fibonacci/n )
18Submitting the TaskExternal Client
Task over RMI
???
!
!
Answer over RMI
19Converting the Jicos AnswerExternal Client
- Convert the Java Result to XML
- createResult()
- Should be able to convert XML ? HTML
- Convert the XML Result for the Client
- Uses XSLT stylesheet (if available)
- Calls toHtmlString() (if appropriate)
- Just send raw XML (lt? lt )
20Sending the XML AnswerExternal Client
!
!
Response over HTTP
21Example Fibonacci ResultExternal Client
- Convert response
- this.FofN resultXml.getValue(
/ExternalResult/Fibonacci/FofN ) - String xml Fib( this.n )
this.FofN \r\n - On browser
- Fib( 10 ) 89
22Sending the ResponseExternal Client
- When to send the response back?
- Short computations wait for result
- Dont send a response until there is an answer
- Browser will sit and spin
- Long computations poll
- Immediately send a response with a result id
- Check back for the answer
23Required FunctionsExternal Client
- Implement default (no-arg) constructor
- Implement XmlConverter
- fromXml() // XML ? Java
- createShared() // XML ? Shared Object
- createInput() // XML ? Input Object
- createResult() // Result ? XML
- getStyleSheet() // XSLT transformation
- toHtmlString() // (XML) Result ? HTML
24Agenda
- Introduction to Jicos
- Extending Jicos to non-Java clients
- Extending Jicos to non-Java services
- Administering a Jicos system
25Modifications to JicosExternal Services
- Jicos any Task can be performed on any Host
- However, a Task using an External (non-Java)
Service may not be able to run on any Host - Licensing issues
- Partitioned information
- Required a modification to Jicos
- Route Task to a proper Host
26How it All WorksExternal Services
27Class HierarchyExternal Services
- External Services class hierarchy
- TaskExternal extends Task
- HostExternal extends Host
- TaskServerExternal extends
- Service specific classes extend those classes
- TaskMatlab extends TaskExternal
- H ostMatlab extends HostExternal
- TaskServerMatlab extends TaskServerExternal
- Jicos then routes Tasks of a certain class
towards Hosts of that class, where the task can
access the service.
28HostExternalExternal Services
- Provides the interaction between the Task and the
external service - Exposes services functions
- Controls service
29Non-Java API JNIExternal Services
- Java Native Interface
- Requires a loadable library (.so/.dll/.dynlib)
- Invokes native code just like Java code
- JNI provides functions to perform object creation
and modification (e.g. arrays) - Java can have a segmentation fault? ?
30Task FlowExternal Services
Task
Task
MTask
Task
MTask
Task
MTask
Task
Task
MTask
Task
31Example Using MatlabExternal Services
- The HostMatlab keeps a reference to the Matlab
engine. - TaskMatlab uses this reference to perform a
Matlab computation - Exposed functions
- putVariable( name, value )
- evalString( matlabCommand )
- getVariable( name )
32Agenda
- Introduction to Jicos
- Extending Jicos to non-Java clients
- Extending Jicos to non-Java services
- Administering a Jicos system
33Starting a Jicos SystemAdminTool
- Previously
- Log in to remote machine, start a HSP
- Log in to another machine, start a TaskServer
- Log in to another machine, start a Host
- Log in to another machine, start a Host
- Log in to another machine, start a Host
- Log in to another machine, start a Host
- Log in to another machine, start a Host
-
- Finally, start a client.
34ChameleonAdminTool
- Starting a system now
- Administrator installs Chameleon to start up as a
system daemon - User starts a Console with a starting
configuration - Take a sip of your favorite beverage
- All requested Jicos components are started
- Done
35Example Start Configuration FileAdminTool
- lt?xml version1.0gt
- ltJicosgt
- ltMachinesgt
- ltMachine namelinux09
addrlinux09.engr.ucsb.edu /gt - ltGroup namecsilgt
- ltMachine namewacko
addrwacko.cs.ucsb.edu/gt - ltMachine namedilbert
addr128.111.43.60/gt -
- lt/Groupgt
- lt/Machinesgt
- ltHsp nameFibonacci groupcsil hosts0gt
- ltTaskServer groupcsil hosts0gt
- ltHost groupcsilgt
- ltHost groupcsilgt
-
- ltHost machinelinux09
exttypematlabgt - lt/TaskServergt
- lt/Hspgt
- lt/Jicosgt
36TuiConsoleAdminTool
- Admin framework is also interactive
- TuiConsole (Text User Interface)
- Start/stop components
- ping services
- Misc development tools (RMI registry)
- GuiConsole
- Future Work
37Summary
- Extending to non-Java clients
- ? XML?Java?Jicos?Java?XML ?
- Extending to non-Java services
- Java Native Interface
- Controlling a Jicos system (AdminTool)
- Chameleon / Console / TuiConsole
38(No Transcript)
39Dedicated to my Assistant (Piglet)
40Supporting Information
41Using HTMLs ltFORMgtExternal Clients
- ltHTMLgt
- ltBODYgt
- ltFORM ACTIONhttp//localhost8181/ExternalReques
t - METHODpostgt
- ltINPUT TYPEhidden
- NAME/ExternalRequest_at_taskName
- VALUEjicos.examples.external.fibonacci.F
ibonaccigt - lt/INPUTgt
- Please enter the Fibonacci Number
- ltINPUT TYPEtext SIZE5
- NAME/ExternalRequest/Fibonacci/ngt
- lt/INPUTgt
- ltINPUT TYPEsubmitgtlt/INPUTgt
- ltINPUT TYPEresetgtlt/INPUTgt
- lt/FORMgt
- lt/HTMLgt