Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

RPC Over DDS

3,605 views

Published on

RPC over DDS – Presentation by Gerardo Pardo-Castellote, CTO, RTI

Published in: Technology
  • Be the first to comment

RPC Over DDS

  1. 1. DDS RPC over DDS Gerardo Pardo-­‐Castellote, Ph.D. Chief Technology Officer, RTI Sumant Tambe, Ph.D. Senior SoBware Reseach Engineer, RTI October 2014
  2. 2. © 2014 Real-­‐Time InnovaJons, Inc. Outline • Goals • Background • Status • Details • More info
  3. 3. © 2014 Real-­‐Time InnovaJons, Inc. Goals • Provide standard and interoperable way means to support “RPC” communicaJon paQerns in DDS • Support the PaQers: – Request/Reply – Service InvocaJon – Remote Procedure Call – Remote Method InvocaJon • Support invocaJon of IDL-­‐specified interfaces over DDS – Provide a simpler way to migrate CORBA applicaJons to DDS – Support familiar “remote interface” programming style equivalent to Java RMI and Apache ThriB
  4. 4. Advantages of RPC over DDS • Client and Servers are decoupled © 2014 Real-­‐Time InnovaJons, Inc. – No startup dependencies • QoS enforcement to support service SLAs – Ownership–Redundant pool of servers – Lifespan–request is only valid for the next N sec – Durability-­‐request/replies will be eventually received and processed – CancellaJon– aBer a good quality response has arrived • Data-­‐Centricity – Explicit trace-­‐ability – InteracJon state can be Monitored, Logged, Audited, Stored, Manipulated • Watch by subscribing to requests and/or responses (wire-­‐tap) • One middleware – leverage DDS infrastructure – Suited for real-­‐Jme systems – MulJpla`orm, MulJlanguage, Interoperable
  5. 5. But I can already do it... True: • I can write my own RCP using request/reply Topics © 2014 Real-­‐Time InnovaJons, Inc. • RTI Connext already supports a “Request/Reply” equivalent to RPC • Some other vendors do similar things But… • The mapping from service to Topics and Types is ad-­‐ hoc. • These approaches are not portable/Interoperable • Gebng everything right is cumbersome at best
  6. 6. How can I do it myself? • Map Interfaces to types & Topics… © 2014 Real-­‐Time InnovaJons, Inc. – One Topic per interface, one per operaJon? – What are the types. How to map excepJons, output parameters, … – What happens if the interfaces change, e.g. operaJon is added or moved? • Implement necessary plumbing: • Setup request topic and type • Setup reply topic and type • Filter unwanted requests • Filter unwanted replies
  7. 7. But RPC is not a good/robust idea/ design paQern…. • RPC versus Desired State PaQern Goal State © 2014 Real-­‐Time InnovaJons, Inc. – Insight: OBen a request-­‐reply can be modeled as stateful data-­‐centric interacJons write Current State Affect Service Client Service Provider Desired State read write read read
  8. 8. RPC vs Desired State • Desired state is good & more robust if the “request” © 2014 Real-­‐Time InnovaJons, Inc. actually represents: – a request to change of system state – Take a long Jme to fulfill – Needs to be observable by others • However: – Many requests that do not represent changes to state: Database Query, Read a File… – People familiar for “Service” or “Request/Reply” paQern may find Directed State cumbersome –specially if extra robustness is unwarranted RPC over DDS provides best of both worlds!
  9. 9. Example: RobotControl © 2014 Real-­‐Time InnovaJons, Inc. module robot { @DDSService interface RobotControl { void command(Command command); float setSpeed(float speed) raises (TooFast); float getSpeed(); void getStatus(out Status status); }; }
  10. 10. RobotControl Client © 2014 Real-­‐Time InnovaJons, Inc. import org.omg.dds.rpc.*; public class TestRobot { static void createRobotClient() { RPCRuntime runtime = RPCRuntime.getInstance(TestRobot.class.getClassLoader()); ClientParams clientParams = runtime.createClientParams(); // optional RobotControlSupport.Client robotClient = RobotControlSupport.createClient( clientParams.withServiceName(”TestRobot”) .withInstanceName(“iRobot”)); // more configs available robotClient.waitForService(); // optional robotClient.getSpeed(); } }
  11. 11. RobotControl Service (Java) package robot; import robot.RobotControl; public class MyRobot implements RobotControl { public void command(Command command) { } public float setSpeed(float speed) { return 1; } public float getSpeed() { return 2; } public void getStatus(/* out */ Status status) { } © 2014 Real-­‐Time InnovaJons, Inc. } import org.omg.dds.rpc.*; public class TestRobot { public static void createRobotServer() { RPCRuntime runtime = RPCRuntime.getInstance(TestRobot.class.getClassLoader()); MyRobot myRobot = new MyRobot(); Server server = runtime.createServer(); // Configurable using ServerParams RobotControlSupport.Service service = RobotControlSupport.createService(myRobot, server); // Configurable using ServiceParams server.run(); // blocking } }
  12. 12. RobotControl Requester public class TestRobot { static void createRobotRequester() { © 2014 Real-­‐Time InnovaJons, Inc. RPCRuntime runtime = RPCRuntime.getInstance(TestRobot.class.getClassLoader()); RequesterParams reqParams = runtime.createRequesterParams(); // change params here if you like Requester<RobotControlSupport.RequestType, RobotControlSupport.ReplyType> requester = runtime.createRequester( RobotControlSupport.RequestType.class, RobotControlSupport.ReplyType.class, reqParams); RobotControlSupport.RequestType request = new RobotControlSupport.RequestType(); // populate request requester.sendRequest(request); } }
  13. 13. RobotControl Replier © 2014 Real-­‐Time InnovaJons, Inc. public class TestRobot { static void createRobotReplier() { RPCRuntime runtime = RPCRuntime.getInstance(TestRobot.class.getClassLoader()); ReplierParams repParams = runtime.createReplierParams(); // change params here if you like Replier<RobotControlSupport.RequestType, RobotControlSupport.ReplyType> replier = runtime.createReplier( RobotControlSupport.RequestType.class, RobotControlSupport.ReplyType.class, repParams); Sample<RobotControlSupport.RequestType> request = replier.receiveRequest(); } }
  14. 14. RobotControlSupport public abstract class RobotControlSupport { public final static class RequestType { // omg.dds.rpc.RequestHeader header; // robot.RobotControl_Call data; © 2014 Real-­‐Time InnovaJons, Inc. } public final static class ReplyType { // omg.dds.rpc.ReplyHeader header; // robot.RobotControl_Return data } public interface Client extends RobotControl, RobotControlAsync, ClientEndpoint { } public interface Service extends ServiceEndpoint { } public static final RobotControlSupport.Client createClient(); public static final RobotControlSupport.Service createService(RobotControl impl); // more client and service factory methods here }
  15. 15. What needs to be specified • Mapping to DDS Topics & Filters © 2014 Real-­‐Time InnovaJons, Inc. – Each operaJon maps to a pair of topics? • Simplicity, Flexibility vs Scalability – Each interface to a pair of Topics? • What are the types? Inheritance? – Is publish-­‐subscribe allowed? e.g. audiJng, monitoring… • Mapping to DDS Data-­‐types – How to model operaJons? Parameters (in, our) return, excepJons, … – Fragility upon interfaces / operaJons changes? – Describable using X-­‐TYPES? • DDS API and DDS-­‐RTPS impact – Are extensions required? – Deployment on top of exisJng DDS • Language Bindings (C, C++, Java, C#, …)
  16. 16. Client Application Service © 2014 Real-­‐Time InnovaJons, Inc. Architecture Service Implementa8on Lang. Bind. GUID2 Data Writer Client-­‐side Invoker Data Reader Data Reader Data Writer GUID1 SN1 Foo GUID2 SN2 GUID1 SN1 Bar Message-id1 Message-id2 Correlation-id1 Language Binding Bar Svc.method(in Foo); Content-­‐based Filter for filtering unwanted replies Foo Bar GUID1 Invoke Return Call Topic Return Topic Foo Bar
  17. 17. Basic and Enhanced Service Mappings • Basic © 2014 Real-­‐Time InnovaJons, Inc. – Highest portability – Enables RPC on top of exisJng (v1.3 or earlier) DDS ImplementaJons • Enhanced – Elegant, Clean – Leverages DDS-­‐XTypes for type matching, – Adds support for Robust service discovery, Implicit request/reply correlaJon Mapping Aspect Basic Service Mapping Profile Enhanced Service Mapping Profile Correla8on Informa8on (request-­‐id) Explicitly added to the data-­‐type Implicit. They appear on the Sample meta-­‐data. Topic Mapping One request topic and one reply topic per interface. 2*N for a hierarchy of N interfaces. One request and one reply topic per interface. Independent of interface hierarchy. Type Mapping Synthesized types compaJble with l e g a c y ( p r e D D S -­‐ X T y p e s ) implementaJons. Use faciliJes of DDS-­‐XTypes for type descripJons, annotaJons, and type-­‐ compaJbility checks. Discovery No special extensions. Robust service discovery (no sample loss due to transient states)
  18. 18. Language Bindings • Two © 2014 Real-­‐Time InnovaJons, Inc. types of language bindings – High-­‐level binding that provide func%on-­‐call semanJcs – Low-­‐level binding that are akin to send/receive (but sJll higher level than raw DDS read/take/write) • Strong separaJon between the data model and language binding Client ApplicaJon FuncJon-­‐call language binding DDS API Service Specification (IDL) Client ApplicaJon Request-­‐Reply language binding DDS API Service ImplementaJon FuncJon call language binding DDS API Service ImplementaJon Request-­‐Reply language binding DDS API Service-­‐specific Interoperable/Evolvable Data model (DDS/RTPS)
  19. 19. © 2014 Real-­‐Time InnovaJons, Inc. QoS Mapping • Default strict reliable (request and reply) – RELIABLE reliability – KEEP_ALL history – VOLATILE durability • Can be changed by the user on a per-­‐service level
  20. 20. © 2014 Real-­‐Time InnovaJons, Inc. @DDSService interface RobotControl { struct RobotControl_setSpeed_In { long s; }; struct RobotControl_getSpeed_In { boolean return_; }; float setSpeed(float speed) raises (TooFast); float getSpeed(); void start(); void stop(); }; @choice @autoid struct RobotControl_Request { RobotControl_setSpeed_In setSpeed; RobotControl_getSpeed_In getSpeed; RobotControl_start_In start; RobotControl_stop_In stop; @empty }; struct start_In { octet dummy_;}; @empty struct stop_In { octet dummy_;};
  21. 21. float setSpeed(float speed) raises (TooFast); float getSpeed(); void start(); void stop(); © 2014 Real-­‐Time InnovaJons, Inc. @DDSService interface RobotControl { }; struct RobotControl_setSpeed_Out { float return_; // Also inout and out params }; … @choice @autoid struct RobotControl_setSpeed_Result { RobotControl_setSpeed_Out out; SystemExcepJonCode sysx_; TooFast toofast_ex; }; … @choice @autoid struct RobotControl_Reply { RobotControl_setSpeed_Result setSpeed; RobotControl_getSpeed_Result getSpeed; RobotControl_start_Result start; RobotControl_stop_Result stop; };
  22. 22. © 2014 Real-­‐Time InnovaJons, Inc. Status • Ongoing standard at OMG • RFP was issued in June 2012 • IniJally 2 compeJng submissions: 1. Joint RTI + eProsima (later joined by TwinOaks) 2. PrismTech • Very different approaches – not converging – EvaluaJon team represenJng 5 companies formed to provide feedback • RecommendaJon was to simplify RTI/eProsima submission • PrismTech dropped their submission and joined RTI/eProsimas’/TwinOaks • Expected to be voted and adopted in Dec 2014 • Completed FuncJon-­‐Call and Request/Reply language binding – Java (hQps://github.com/rJcommunity/dds-­‐rpc-­‐java) – C++* (hQps://github.com/rJcommunity/dds-­‐rpc-­‐cxx) – eProsima has POC implementaJon of “basic” profile working with several DDS implementaJons
  23. 23. QuesJons? © 2014 Real-­‐Time InnovaJons, Inc.
  24. 24. © 2014 Real-­‐Time InnovaJons, Inc. Find out more… dds.omg.org www.omg.org www.rJ.com community.rJ.com demo.rJ.com www.youtube.com/realJmeinnovaJons blogs.rJ.com www.twiQer.com/RealTimeInnov www.facebook.com/RTIsoBware www.slideshare.net/GerardoPardo www.slideshare.net/RealTimeInnovaJons

×