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.

High Performance Messaging for Web-Based Trading Systems


Published on

Video and slides synchronized, mp3 and slide download available at

Frank Greco investigates WebSocket and how trading systems can be designed to leverage it for reliability, security and performance for desktop, mobile, datacenter and cloud environments. Filmed at

Frank D. Greco is the Director of Technology for Kaazing Corporation. He is responsible for the Kaazing cloud computing strategy and guiding customers with new technology approaches. Frank has extensive experience in IT projects for over 15 years and has worked on global architecture, grid/cloud computing, innovative user interfaces and mobile computing. Twitter: @frankgreco

  • I pasted a website that might be helpful to you: ⇒ ⇐ Good luck!
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ❶❶❶ ❶❶❶
    Are you sure you want to  Yes  No
    Your message goes here
  • Dating direct: ❤❤❤ ❤❤❤
    Are you sure you want to  Yes  No
    Your message goes here

High Performance Messaging for Web-Based Trading Systems

  1. 1. High Performance MessagingforWeb-based Trading SystemsFrank Greco - @frankgreco Director of Technology, Kaazing
  2. 2. Watch the video with slide synchronization on! /messaging-web-trading News & Community Site• 750,000 unique visitors/month• Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese)• Post content from our QCon conferences• News 15-20 / week• Articles 3-4 / week• Presentations (videos) 12-15 / week• Interviews 2-3 / week• Books 1 / month
  3. 3. Presented at QCon London www.qconlondon.comPurpose of QCon- to empower software development by facilitating the spread ofknowledge and innovationStrategy - practitioner-driven conference designed for YOU: influencers ofchange and innovation in your teams- speakers and topics driving the evolution and innovation- connecting and catalyzing the influencers and innovatorsHighlights- attended by more than 12,000 delegates since 2007- held in 9 cities worldwide
  4. 4. Outline §  Background §  Trading Systems and the Web §  Requirements §  Web Messaging for Trading Apps §  Layered Approach to Web Protocols §  New Requirements §  The Web beyond the Browser© 2013 Kaazing Corporation
  5. 5. Background §  Financial Services – Capital Markets §  Desktop trading systems – Swing/Java/TIBCO, et al §  Customer use cases – FX, Commodity desks §  Director of Technology @ Kaazing §  Chairman NYJavaSIG ( §  Largest JUG in North America 7,000+ members §, @frankgreco© 2013 Kaazing Corporation
  6. 6. Web Trading Systems FX Trader Application – front office© 2013 Kaazing Corporation
  7. 7. What is a Web Trading System §  Trading System – A set of rules governing buying/selling §  An application that expedites a trading system §  Modern Web Trading requirements -  HTML5 – no more plugins -  UI/UX – Sencha/extJS, GWT, jQuery, GPU acceleration, etc -  Usable application cache -  Fast, reliable, secure -  Minimal impact to back-end services -  Works with pub/sub brokers and data feeds -  High message rate, small payload – equity ticks, watchlist, currency pairs, etc.© 2013 Kaazing Corporation
  8. 8. Everything sounds do-able, except… §  Designed for document transfer – HTTP -  Short-lived Request / Response interaction §  Bidirectional, but half-duplex -  Traffic flows in only one direction at a time §  Stateless -  Large amounts of metadata resent for each request Web was not designed for “real-time”, event-based services…© 2013 Kaazing Corporation
  9. 9. Some things age well… HTTP TCP© 2013 Kaazing Corporation
  10. 10. …and some things don’t Oldies Hits - AJAX and the Comet Pollers - 2006© 2013 Kaazing Corporation
  11. 11. High-Level Trading Systems ArchitectureiOS/Android Pricing Feeds Authentication Authorization Mobile Browser/Native Client Make Net me Msg News/Alerts Web Broker friendly Browser JMS/AMQP etc… Trade Exec What everyone does… Desktop Java/.NET Reports © 2013 Kaazing Corporation
  12. 12. High-Level Trading Systems ArchitectureiOS/Android Pricing Feeds Authentication Authorization Mobile Browser/Native Client Make Net me Msg News/Alerts Web Broker friendly Browser JMS/AMQP etc… Trade Exec Developers want a secure version of this Desktop architecture so they Java/.NET can focus on the app Reports © 2013 Kaazing Corporation
  13. 13. Real-time Client/Server Architecture Instead, we try this traditional solution Trading App Broker Just have to open some ports… Merely deploy Java/.NET on Only need to traverse several client… proxies between the endpoints… Easy, right?...© 2013 Kaazing Corporation
  14. 14. Middleware for the Middleware Or we try to proxy things over the web ticker plant Scalability    Issues…   Protocol  mismatches…   Inefficient…   Latency  Issues…  © 2013 Kaazing Corporation
  15. 15. Things aren’t looking too good…© 2013 Kaazing Corporation
  16. 16. Welcome HTML5 (aka The New Web)! §  Users are Demanding more from Apps §  UI/UX Requirements are more sophisticated §  API Explosion §  Browser Enhancements §  Web no longer just about Documents but the existing infrastructure reflects this legacyThe New Web is a Foundation for Enterprise-grade Applications 14© 2013 Kaazing Corporation
  17. 17. WebSocket •  “Real-Time”, bi-directional connectivity •  IETF Protocol - RFC 6455 – Dec 2011 •  W3C API •  Easily add event-based (trading) data to web apps •  Avoids polling •  Avoids HTTP meta-data overhead •  Shares port with HTTP (80/443) •  Peer protocol to HTTP (both use TCP) •  Most Important API in HTML5 •  Facilitates other protocols •  Puts the web in a better place…© 2013 Kaazing Corporation
  18. 18. WebSocket Standards §  W3C API – Candidate Recommendation - §  IETF Formal Protocol (RFC 6455) -  Event-driven JavaScript API -  Full-duplex communication protocol §  Integrates HTTP addressing -  ws:// -  wss:// §  Traverses firewalls, proxies, routers securely §  Text and Binary §  Leverages Cross-Origin Resource Sharing (CORS)© 2013 Kaazing Corporation
  19. 19. The WebSocket Handshake© 2013 Kaazing Corporation
  20. 20. For Real-Time, Event-based Web Communication… Legacy HTTP vs WebSocket Seems like a no-brainer for trading apps… 18© 2013 Kaazing Corporation
  21. 21. Java API for WebSocket - JSR 356 §  Creation of WebSocket Java components to handle bi-directional WebSocket conversations §  Handling WebSocket events §  Creation and consumption of WebSocket text and binary messages §  Allows for WebSocket protocols and content models for an application §  Configuration and management of WebSocket sessions, like timeouts, retries, cookies, connection pooling §  Specification of how WebSocket application will work within the Java EE security model! §  Official Java SE WebSocket API in the works…© 2013 Kaazing Corporation
  22. 22. Why do I Care? What does this really have to do with high- performance messaging?© 2013 Kaazing Corporation
  23. 23. Legacy Web Half Duplex - HTTP Full duplex Web Browser Web Tier Middleware Msg Broker Live Web Full duplex - WebSocket Full duplex Web WebSocket Msg Broker Server© 2013 Kaazing Corporation
  24. 24. Scalability – more traders, more services Complexity More Traders More Services More…More… Growth Greco’s Law! Scalability = Growth / Complexity Simple things scale… 22© 2013 Kaazing Corporation 22
  25. 25. HTML5 WebSocket API© 2013 Kaazing Corporation
  26. 26. HTML5 WebSocket API But… Dealing with WebSocket is like dealing with TCP. It’s a streams-based model. You need to understand how to handle streams-based data over the wire. So how do I do publish/subscribe for my trading system?© 2013 Kaazing Corporation
  27. 27. What is Missing? Where is the Application-level Protocol? •  Who handles retries? •  How do we handle publish/subscribe semantics? •  How do we handle market data? •  Is guaranteed delivery possible (trades)? •  What if the client is not active? •  How do we handle [fill in with favorite semantics] •  What about partials? •  Who’s responsible for entitlements? How do I manage that? •  etc…© 2013 Kaazing Corporation
  28. 28. But wait… Protocol Layering is Possible!Whoa…  Its  just  like  TCP!      Huzzah!   Browser and Native Applications JMS XMPP AMQP B2B FTP VNC mktdata etc WebSocket TCP Internet WebSocket WebSocket Gateway Gateway© 2013 Kaazing Corporation
  29. 29. Anything Else Missing? Other Considerations… •  Need to handle multiple WS versions •  Need to handle multiple (and legacy) browser versions •  Can’t have business logic in the DMZ •  Have to work in multiple DMZs •  AuthN/AuthZ has to work multiple times •  High-availability topology •  Concerns about open ports with back-end service •  Services architecture needs to be consistent •  Native, HTML5 and hybrid environments •  Integrate easily with non-messaging services •  XaaS integration – the Web beyond the browser •  Bandwidth management •  etc… All things you need for a real enterprise app© 2013 Kaazing Corporation
  30. 30. Publish/Subscribe over the Web for Trading Systems Java Message Service (JMS) over WebSocket A 60-second Tutorial In case you haven’t heard of JMS…© 2013 Kaazing Corporation
  31. 31. Java Message Service (JMS) •  Java EE Message Oriented Middleware •  JMS 1.0 2001, JMS 1.1 2002, JMS 2.0 (Feb 26, 2013) •  Asynchronous Messaging vs. RPC •  Loosely coupled vs. Tightly coupled •  Pub/Sub, Topics, Queues •  Transactions, Reliable© 2013 Kaazing Corporation
  32. 32. Basic Inside-the-Firewall JMS conn = createConnection(); sess = conn.createSession(); topic = jndiContext.lookup(topic); pub = sess.createProducer(topic); pub.send(“hey Frank”); conn = createConnection(); conn = createConnection(); sess = conn.createSession(); conn conn.createSession(); = createConnection(); topic = = = conn.createSession(); sess jndiContext.lookup(topic); sess jndiContext.lookup(topic); sub = = = jndiContext.lookup(topic); topic sess.createConsumer(topic); topic sub = sess.createConsumer(topic); sub.setMessageListener(this); sub = sess.createConsumer(topic); sub.setMessageListener(this); … sub.setMessageListener(this); … public void onMessage(Message m) { … public voidm.getText(); = onMessage(Message m) { String s void onMessage(Message m) { public s = m.getText(); msg String … do stuff… m.getText(); String s = … do stuff… broker } } … do stuff… }© 2013 Kaazing Corporation
  33. 33. Now… JMS API for JavaScript 1.  Create connection from ConnectionFactory see 2.  Create session 3.  Create topic or queue 4.  Create producer 5.  Create consumer 6.  Create message listeners (function to handle messages)2 session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);3 var myTopic = session.createTopic("/topic/myTopic");4 topicProducer = session.createProducer(myTopic);5 topicConsumer = session.createConsumer(myTopic);6 topicConsumer.setMessageListener(handleTopicMessage);© 2013 Kaazing Corporation
  34. 34. JMS API for JavaScript 7.  Send messages var doSend = function(message) { message.setStringProperty(MESSAGE_PROPERTIES.userId, userId); topicProducer.send(null, message, DeliveryMode.NON_PERSISTENT, 3, 1, function() sendFromQueue(); }); }; 8.  Process messages: the message listener function: handleTopicMessage() var handleTopicMessage = function(message) { if (message.getStringProperty(MESSAGE_PROPERTIES.userId) != userId) { $("#slider").val(message.getText()); $("#pic").width(message.getText()); } };© 2013 Kaazing Corporation
  35. 35. WebSocket Projects, OSS, Vendors •  Kaazing •  Node.js/ •  ActiveMQ •  Tomcat •  Jetty •  Oracle Glassfish •  Java EE •  Play Framework •  Rabbit MQ •  JBoss •  IIS/ASP .NET 4.5 •  PHP, Objective-C, Ruby, Python, C/C++, JVM-langs… •  Many more…© 2013 Kaazing Corporation
  36. 36. Futures What’s next for Trading Systems and the Web? 34© 2013 Kaazing Corporation
  37. 37. New Computing Model Clouds 35© 2013 Kaazing Corporation
  38. 38. New Computing Model Storage Regulatory Docs hypothetical Email Cloud Cloud Clearance websocket websocket Collaboration Cloud websocket websocket Wealth Management websocket Notifications Enterprise Transactions Cloud FX Cloud Cloud Sentiment Analytics Risk AnalysisManagement 36© 2013 Kaazing Corporation
  39. 39. Inter-Cloud Connectivity or XaaS Clearance as Compliance a Serviceas a Service External Cloud Service Bus websocket service service service Risk Management Regulatory as a Service iPaaS Auditing as a Service websocket Internet Service Bus Enterprise Enterprise Service Bus service service service 37© 2013 Kaazing Corporation
  40. 40. Event-based XaaS – Everything as a Service in Real-Time Integration as a Service Monitoring as a Service Governance as a Service Identity as a Service Testing as a WAN Optimization as a Service Risk Analytics Service as a Service Data Center as a Service Windows Desktop Enterprise Messaging as a Service as a Service CDN as a Service Network as a Service Sentiment Analysis as a Service Trade Clearance as a Service Database as a Service Notification as a Service Security as a Service Backup Analytics as a Service as a Service EAI as a Service Telephony as a Auditing as a Service Service 38© 2013 Kaazing Corporation
  41. 41. Global Distribution – Next Generation CDN© 2013 Kaazing Corporation
  42. 42. Questions?© 2013 Kaazing Corporation
  43. 43. Enterprise-Quality Features – WebSocket++ Extends Browser as 24x7 Global IETF RFC full enterprise client Full JMS API for Support Compliance JavaScript, .NET, No business logic in Flash, iOS, Android Can Connect to Gateway - can be (soon) any TCP or UDP installed securely in DMZ Granular Client data source Timeouts for mobile JMS Topics, Queues, to detect offline Emulation when Durables, Acks for intermediaries block Guaranteed msgs iOS-APNS & native WS Android/GCM JMS Edition Works with any Integration JMS provider - no broker lock-in AuthN/AuthZ Bandwidth Kerberos and SSO Control Secure Services – can over WS integration close all inbound ports No Server-Side API Emulates WebSocket End-to-End for messaging needed protocol for old encrypted messages for legacy integration browsers w/ no polling for multiple DMZs© 2013 Kaazing Corporation