Don't call us - we'll push – on cross tier push architecture<br />Lucas Jellema – AMIS (Nieuwegein, The Netherlands)<br />...
Overview<br />Asynchronous to the max<br />Push in enterprise architecture<br />The harsh reality of push<br />Web-tier to...
Asynchronous communication in the real world<br />“I’ll get back to you”<br />“Don’t call us,…”<br />Low fuel warning in c...
Asynchronous interactions and push in the IT landscape<br />More timely information<br />Notification as soon as possible<...
Pushing it … into the user interface<br />Automatically refreshing (part of) a page<br />Update table<br />Redrawing chart...
3rd party<br />Mobile Device<br />Mobile Device<br />Web Browser<br />Web Browser<br />JEE Application Server<br />JEE App...
Upstream notification<br />Database to Middle Tier<br />Middle Tier to Browser or Mobile device<br />Browser to other Brow...
Typical server-to-client push scenario: CHat<br />Web Browser<br />JEE Application Server<br />
And client to server (to server)<br />Web Browser<br />JEE Application Server<br />
The ‘Only tell when asked’ game<br />
Server Push challenges<br />How to push against the ‘one way direction’ and despite limitations<br />HTTP and JDBC are req...
Server Push challenges (2)<br />Where do events to push actually come from?<br />Who perceives/receives (real-time) events...
Server to web client<br />AJAX – Asynchronous<br />Not as asynchronous as you might think<br />Reverse AJAX – Comet , Push...
Comet – implementations<br />Client side: <br />many  libraries – DOJO is most notable<br />most AJAX/JavaScript based<br ...
Direct Web Remoting<br />Call client side JavaScript functions from Server<br />In multiple browser sessions<br />Synchron...
Server push with DWR<br />DWR configuration:<br />Servlet in web.xml<br />WEB-INF/dwr.xml with beans to expose to JavaScri...
Client to Server push to client<br />Web Browser<br />Web Browser<br />HTML + JavaScript<br />HTML + JavaScript<br />JEE A...
The nudge<br />Event should have small payload – just an indication of the type of event and a key-reference to the payloa...
websockets<br />Protocol – TCP based, initiated with normal HTTP exchange<br />One more transport option for Comet<br />Fi...
<ul><li>Usually really a combination of
Client-to-Server
and Server-to-the-other-Client push
Exception: Blue Tooth, Near-Field Communication</li></ul>Mobile Device<br />Mobile Device<br />Web Browser<br />Web Browse...
Server to mobile push:multiplexed, semi-poll based<br />
Apple push notification service<br />Persistent TCP/IP connection<br />Continuously streaming<br />TCP/IP connection is in...
Apple push notification service<br />Using APNS, only one channel is used for all messages to be pushed to a device<br />S...
Android push notification multiplexed from the cloud<br />
Cross gap push mechanisms<br />Many channels are available to push messages from one entity to another<br />across applica...
JMS (Java Message Service) == The “inter application Mail Man”<br />Application A<br />JMS<br />Queue<br />Application B<b...
JMS Queue/TOPIC Listener<br />JMS Listener is notified asynchronously of messages<br />Start background job on behalf of w...
Live volleyball reporting<br />Web Browser<br />UI handler<br />JMS Queue<br />Listener (http channel, JMS, ..)<br />BAM<b...
Cross tier push – architecture pattern<br />listener<br />listener<br />listener<br />register<br />event handler<br />Pay...
The Hollywood Principle: Query ResultSet Change Notification<br />
Middle tier alerted by Database<br />Oracle RDBMS invokes Java Listener with event details<br />Register DatabaseChangeNot...
Register Database Change Listener<br />
Query Result Change listener<br />
Update in database triggers notification to Java Listener<br />
Multiplexed Poll-based database-to-middle tier push<br />When no Database Query Result Change Notification is available – ...
Database to Middle Tier to Client notification<br />Session cache<br />Application Scope <br />event handler<br />D<br />4...
Demo cross tier push – database  middle tier  browser<br />
Multiplexed Poll-based database-to-middle tier push<br />A poll based approach can emulate the push behavior<br />One thre...
Upcoming SlideShare
Loading in...5
×

Don't call us - we'll push - cross tier push architecture (JavaOne 2011)

3,960
-1

Published on

Pushing information is a decoupled and performance effective way to ensure interested parties have the most recent information ASAP.

This session looks at reasons and technology for pushing information at various points in an enterprise architecture. Databases can push to the middle tier, the middle tier pushes to the browser and mobile app - triggered by email, chat, JMS message or CEP event and one client can push to another. The link with Event Driven Architecture is explored.

HTTP Channels and Web Sockets are demonstrated as well as AJAX based background push, database query result change notification and HTTP calls from the database. We'll look at what to send in an event and how to present the push signal in the end user interface.

Attendees will learn how to effectively leverage concepts (such as Bayeux) and technologies to implement push-across-the-tiers in a scalable fashion- thus creating a modern application that satisfies the modern end user.

* Introduce push in the real world: don't call us and other examples
* Explain how push is good for performance (no polling), for decoupling (consumer does not need to know where the push comes from) and most up-to-date information available (as opposed to polling)
* Discuss architecture and all the gaps between and within tier where push may be required and how the trigger can originate
* Demonstrate how push can be implemented from a database to the middle tier (for example to refresh cache or send signal that ends up in client)
* Demonstrate how push can be implemented from middle tier to client - and what it can be used for
* Discussion of presentation/visualization of asynchronous, push-based refresh of client
* Leveraging the server-client push, demonstrate how client-client push can be implemented (through client-server AJAX and server-client push)
* Demonstrate end-to-end push: database undergoing some DML finally resulting in a browser being refreshed
* Linking Push with Event Driven Architecture and Complex Event Processing
* Brief future outlook

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
  • lucas, u were awesome today @ java one.. i was there @ nikko.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
3,960
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
70
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide
  • Pushing information is a decoupled and performance effective way to ensure interested parties have the most recent information ASAP.This session looks at reasons and technology for pushing information at various points in an enterprise architecture. Databases can push to the middle tier - as a result of DML - the middle tier pushes to the browser - triggered by email, chat, JMS message or CEP event and one client can push to another. The link with Event Driven Architecture is explored.HTTP Channels and Web Sockets are demonstrated as well as AJAX based background push, database query result change notification and HTTP calls from the database. We&apos;ll look at what to send in an event and how to present  the push signal in the end.  * Introduce push in the real world: don&apos;t call us and other examples* Explain how push is good for performance (no polling), for decoupling (consumer does not need to know where the push comes from) and most up-to-date information available (as opposed to polling)* Discuss architecture and all the gaps between and within tier where push may be required and how the trigger can originate* Demonstrate how push can be implemented from a database to the middle tier (for example to refresh cache or send signal that ends up in client)* Demonstrate how push can be implemented from middle tier to client - and what it can be used for* Discussion of presentation/visualization of asynchronous, push-based refresh of client* Leveraging the server-client push, demonstrate how client-client push can be implemented (through client-server AJAX and server-client push)* Demonstrate end-to-end push: database undergoing some DML finally resulting in a browser being refreshed* Linking Push with Event Driven Architecture and Complex Event Processing* Brief future outlook* Summary
  • AsYnchronous communication &amp; cross tier push in enterprise landscape
  • Two participantsOne can ask questionsThe other can reply; a response is ended with ‘end of message’; after that has been said, the responder has to wait for the next question to be asked before saying anything out loudChallenge: the requestor needs to know as fast as possible and with as few questions asked as possible when the responder is tapped on the back
  • http://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/RemoteNotificationsPG.pdf
  • Don't call us - we'll push - cross tier push architecture (JavaOne 2011)

    1. 1. Don't call us - we'll push – on cross tier push architecture<br />Lucas Jellema – AMIS (Nieuwegein, The Netherlands)<br />JavaOne 2011, Birds of a Feather<br />
    2. 2. Overview<br />Asynchronous to the max<br />Push in enterprise architecture<br />The harsh reality of push<br />Web-tier to client<br />Browser<br />Mobile App<br />Client to client<br />Database tier to Business tier<br />Cross Server Push<br />Push All the way<br />The future of push<br />Real time<br />
    3. 3. Asynchronous communication in the real world<br />“I’ll get back to you”<br />“Don’t call us,…”<br />Low fuel warning in car<br />“Please let me know”<br />“Return to sender – address unknown” <br />Newspaper delivery<br />Next instruction from car navigation system<br />Telephone ringing<br />Alarm clock buzzing<br />Parking sensors beeping<br />Fire alarm screaming<br />
    4. 4. Asynchronous interactions and push in the IT landscape<br />More timely information<br />Notification as soon as possible<br />Proactive offering<br />Do not ask and you shall be given <br />Lower load on back end – don’t call us (all the time) …<br />Stop hitting the F5 button!<br />Multi-channel information manipulation and dissemination<br />Changes and events come in from everywhere<br />Decouple system components through generic infrastructure for handling events and push<br />Yet integrate<br />
    5. 5. Pushing it … into the user interface<br />Automatically refreshing (part of) a page<br />Update table<br />Redrawing chart<br />Displaying popup to alert user to an event<br />Arrival of message (email or chat)<br />Signing in or out of contact (presence)<br />Lock or release of some resource<br />Notification<br />Changing status of items on the page<br />Highlight change indicator<br />Show icon<br />Change text to italic<br />Play a sound<br />
    6. 6. 3rd party<br />Mobile Device<br />Mobile Device<br />Web Browser<br />Web Browser<br />JEE Application Server<br />JEE Application Server<br />Complex Event Processor<br />Non<br />Java<br />Server<br />RDBMS<br />Email Server<br />Chat Server<br />RDBMS<br />
    7. 7. Upstream notification<br />Database to Middle Tier<br />Middle Tier to Browser or Mobile device<br />Browser to other Browser or Mobile device<br />Mobile Device<br />Web Browser<br />JEE Application Server<br />RDBMS<br />
    8. 8. Typical server-to-client push scenario: CHat<br />Web Browser<br />JEE Application Server<br />
    9. 9. And client to server (to server)<br />Web Browser<br />JEE Application Server<br />
    10. 10. The ‘Only tell when asked’ game<br />
    11. 11. Server Push challenges<br />How to push against the ‘one way direction’ and despite limitations<br />HTTP and JDBC are request/response – not response only<br />Browser limit of only two channels to one server<br />Server side ‘event handling’<br />Session has to have an active life beyond requests<br />Or requests have a life beyond response<br />Higher load on the server<br />How to handle the (potential) volume of ‘concurrent’ channels and the number of open threads<br />NIO, Servlet 3.0, Jetty Continuations, Tomcat Advanced I/O<br />
    12. 12. Server Push challenges (2)<br />Where do events to push actually come from?<br />Who perceives/receives (real-time) events (on the server side)<br />How are they tied in to the appropriate sessions?<br />Client (consumer) side: how to asynchronously receive events and how to process them/turn them into action and UI updates<br />How to correlate an asynchronously received message with a previously sent request or a subscription<br />For example: mobile phone showing SMS or WhatsApp messages in a conversation thread style<br />
    13. 13. Server to web client<br />AJAX – Asynchronous<br />Not as asynchronous as you might think<br />Reverse AJAX – Comet , Push<br />Comet implementations<br />Streaming – never ending response<br />Poll<br />Long Poll<br />Piggy Back (add push message to normal response)<br />Embedded Applet doing raw TCP communications<br />Flash with BlazeDS event streaming<br />WebSockets<br />
    14. 14. Comet – implementations<br />Client side: <br />many libraries – DOJO is most notable<br />most AJAX/JavaScript based<br />Applets could also be used (via Applet/JS bridge)<br />Server Side: <br />plain servlets, <br />Servlet 3.0 to alleviate the load on the server from all the open long-lived requests …<br />Grizzly (GlassFish)<br />WebLogic HTTP Channel<br />GWT?<br />DWR – Direct Web Remoting<br />LightStreamer<br />Jetty<br />Zie: http://cometdaily.com/maturity.html<br />
    15. 15. Direct Web Remoting<br />Call client side JavaScript functions from Server<br />In multiple browser sessions<br />Synchronously as part of request handling<br />Asynchronously – as server (initiated) push<br />Call server side Java methods from the Client<br />Leading to asynchronous (“background”) AJAX calls<br />
    16. 16. Server push with DWR<br />DWR configuration:<br />Servlet in web.xml<br />WEB-INF/dwr.xml with beans to expose to JavaScript<br />Web Browser<br />HTML + JavaScript<br />JEE Application Server<br />Clock<br />
    17. 17. Client to Server push to client<br />Web Browser<br />Web Browser<br />HTML + JavaScript<br />HTML + JavaScript<br />JEE Application Server<br />Servlet<br />EventsProcessor<br />SomeTableWithEventsCoordinator<br />SomeTableWithEventsCoordinator<br />
    18. 18. The nudge<br />Event should have small payload – just an indication of the type of event and a key-reference to the payload<br />Based on the information, the consumer decides to retrieve the associated payload, using the key<br />UI Component<br />nudge handler<br />Payload Retriever<br />Nudgee<br />Nudger<br />
    19. 19. websockets<br />Protocol – TCP based, initiated with normal HTTP exchange<br />One more transport option for Comet<br />Finalized last week!<br />Client and Server API<br />JavaScript (client)<br />Server side?<br />Part of HTML 5<br />A very loose collection of proposals, concepts and specifications<br />Supported in Chrome and Safari as well as Firefox, …<br />Also from mobile platform<br />Server Side Support very fragmented at this point<br />With the protocol finalized, server support will rapidly emerge<br />
    20. 20. <ul><li>Usually really a combination of
    21. 21. Client-to-Server
    22. 22. and Server-to-the-other-Client push
    23. 23. Exception: Blue Tooth, Near-Field Communication</li></ul>Mobile Device<br />Mobile Device<br />Web Browser<br />Web Browser<br />JEE Application Server<br />Client to client<br />
    24. 24. Server to mobile push:multiplexed, semi-poll based<br />
    25. 25. Apple push notification service<br />Persistent TCP/IP connection<br />Continuously streaming<br />TCP/IP connection is initially set up by client<br />Passing its identifier to APNS<br />Server side of applications can send messages to APNS with the device identifier<br />APNS streams these messages to the device<br />Message payload is JSON<br />
    26. 26. Apple push notification service<br />Using APNS, only one channel is used for all messages to be pushed to a device<br />Shared by many different applications<br />APNS does store-and-forward (to retain messages when the client is off-line)<br />Note: the push payload is very small (< 256 bytes)<br />just enough for the client to initiate a request for the real information<br />
    27. 27. Android push notification multiplexed from the cloud<br />
    28. 28. Cross gap push mechanisms<br />Many channels are available to push messages from one entity to another<br />across application, technology and location boundaries<br />JMS (Java/JEE specific) <br />(one way) WebService (SOAP or REST)<br />“HTTP Channel”<br />WebSockets<br />Http Call to Servlet<br />XMPP<br />
    29. 29. JMS (Java Message Service) == The “inter application Mail Man”<br />Application A<br />JMS<br />Queue<br />Application B<br />Application X<br />Application C<br />JMS is perfect for highly decoupled, scalable, cross JVM/cross server, reliable event push<br />JMS is available on any JEE platform<br />JMS is Java only<br />Mobile devices, browsers, databases and .NET do not speak JMS<br />
    30. 30. JMS Queue/TOPIC Listener<br />JMS Listener is notified asynchronously of messages<br />Start background job on behalf of web app<br />Note: spawn thread from Servlet or EJB is not recommended<br />Create report, send email, execute batch job<br />Listen to events on behalf of web application <br />And inform web application of relevant stuff<br />Web Application<br />JMS Queue or Topic<br />MDB<br />JMS Queue or Topic<br />Web Application<br />?<br />MDB<br />EJB<br />
    31. 31. Live volleyball reporting<br />Web Browser<br />UI handler<br />JMS Queue<br />Listener (http channel, JMS, ..)<br />BAM<br />Data Object<br />
    32. 32. Cross tier push – architecture pattern<br />listener<br />listener<br />listener<br />register<br />event handler<br />Payload Retriever<br />Scheduled Poll Job<br />Push Receptor<br />‘Events collector’<br />
    33. 33. The Hollywood Principle: Query ResultSet Change Notification<br />
    34. 34. Middle tier alerted by Database<br />Oracle RDBMS invokes Java Listener with event details<br />Register DatabaseChangeNotification<br />SQL query<br />
    35. 35. Register Database Change Listener<br />
    36. 36. Query Result Change listener<br />
    37. 37. Update in database triggers notification to Java Listener<br />
    38. 38. Multiplexed Poll-based database-to-middle tier push<br />When no Database Query Result Change Notification is available – a trick is needed<br />Some databases can do HTTP calls:<br />
    39. 39. Database to Middle Tier to Client notification<br />Session cache<br />Application Scope <br />event handler<br />D<br />4<br />3<br />9<br />C<br />5<br />A<br />servlet<br />servlet<br />1<br />8<br />2<br />HTTP<br />B<br />Proce-dure<br />7<br />EMP<br />Job<br />6<br />
    40. 40. Demo cross tier push – database  middle tier  browser<br />
    41. 41. Multiplexed Poll-based database-to-middle tier push<br />A poll based approach can emulate the push behavior<br />One thread in the middle tier does polling on behalfof all sessions: a single channel<br />A single table in the database isused to collectall ‘pushableevents’<br />Middle tier pollretrieves new entries from thetable and publishedevents to centralevent handler<br />Listeners registeredwith a centralevent handler<br />Application Scope <br />event handler<br />session<br />session<br />Scheduled Job<br />session<br />CD_TBL<br />Notifications<br />Proce-dure<br />
    42. 42. Future Developments<br />The real time enterprise<br />The event driven enterprise<br />Further evolution of push notification at every tier<br />Mobile perhaps leading the way<br />Infrastructure and frameworks providing push mechanisms<br />Servlet 3.0, Java NIO, WebSockets,SPDY, XMPP and other lighter weight solutions for bi-directional communication over TCP<br />And broad support in browsers and application servers<br />For example: upcoming WebSockets supportin Glassfish and WebLogic<br />
    43. 43. Summary<br />Asynchronous interaction is good for decoupling, decreasing load on system and increasing timeliness<br />Push is valuable at various levels and between different components in the enterprise architecture<br />Challenges: <br />push is often against the [http, JDBC,..] grain<br />correlate push notifications into right consumer<br />handle asynchronously received push messages<br />prevent swamping of infrastructure<br />Server to client push will gain in scalability and ease<br />Thanks to WebSockets and implementations thereof and libraries (e.g. Dojo) leveraging it<br />Also used for server-to-server and client-to-client<br />Push is an essential ingredient of modern applications – from browser and mobile to middle tier and database<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×