Server side push in Aldan 3


Published on

Describes server side push technology and particular implementation

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Server side push in Aldan 3

  1. 1. Server pushLeveraging server push technologies (Comet) inWebBee frameworkDmitriy RogatkinJanuary 2012
  2. 2. Introduction in server push  What is server push for a web application? • Capability of a server to deliver new content to a browser without user interaction  Is it well known or something new? • Pure HTML multipart x-mixed-replace request type (Netscape, MS) seems supported from 1998 • multipart x-mixed-replace has limited support of browser vendors and has different behavior for Netscape (Mozila) and MS (IE) • multipart x-mixed-replace is not JS friendly and useless for Ajax • XML-HTTP object can be used for server push more efficiently with some challenges, this approach is relatively -new 5 years old  Where server push is useful? • Update a user about status of long running processes • Alerting a user that system state changed • Collaborative work as chat, concurrent update resources and so on2 © 2011 Progress Software Corporation. All rights reserved.
  3. 3. Challenges of server push  Four approaches are widely used 1. Keeping active connection with server (multipart x-mixed-replace or XML-HTTP, or XMLHTPP awaiting for response) 2. Polling a server in setTimeout or setInterval, or refresh 3. Piggy back ride of any user interaction (not really push) 4. Utilizing HTML5 Websockets (will be presented separately) 1. Holding a thread servicing request – challenge is to serve hundreds concurrent users can overload thread capacity of a server OS 2. Polling requests – challenge is multiple requests from hundreds concurrent users can overload a server performance capacity 3. Load additional information to any response to reflect server push items updates, the challenge is more complex responses and still requires user interaction (not truly server push)3 © 2011 Progress Software Corporation. All rights reserved.
  4. 4. Dealing with challenges  Avoid using polling mechanism  Release a servicing thread and keep just connection allowing a separate thread pushing data in it asynchronously  How is it implemented • Vendor specific ;Tomcat, Jetty, AsyncWeb and other provide proprietary mechanism of releasing or not involving a servicing thread per request • JSR315 AsyncContext is a standard  JSR 315 is standard releases a dependency on a particular vendor, it is flexible and simple  Where JSR315 is supported • TJWS • Jetty • Tomcat, JBOSS and Oracle WebLogic and IBM WebSphere4 © 2011 Progress Software Corporation. All rights reserved.
  5. 5. How to make server push simple for use  Detach all async request specific machinery in a framework  Provide simple and flexible way to use it  How has it done for WebBee? • Base servlet framework is extended to manage asynchronous requests and additional common Ajax handlers and services were added  How to use it? 1. Identify set of users interested in a certain event UI update 2. For those users who are currently online push UI notification event to AsyncUpdater service queue 3. Provide JS event handlers in View implementation to show UI updates corresponding for the pushed events 4. Done5 © 2011 Progress Software Corporation. All rights reserved.
  6. 6. Server push framework architecture6 © 2011 Progress Software Corporation. All rights reserved.
  7. 7. Implementation highlights  Developed on top of Aldan 3 servlet framework  Small foot print JavaScript push event dispatcher  Async update Ajax handler connected to base page service  Registry of push event consumer pile  Async updater service (component) • Manages queue of push UI event • Dispatches available events to piled async requests7 © 2011 Progress Software Corporation. All rights reserved.
  8. 8. Room for improvements  Won’t work in clustering environment unless Async updater service manages a distributed event queue • Resolution can be providing distributed event queue  Container managed session timeout can not work as expected since server push activities may keep session valid all time • Resolution can be in own client or server session timeout implementation8 © 2011 Progress Software Corporation. All rights reserved.
  9. 9. Demo  WebBee chat application9 © 2011 Progress Software Corporation. All rights reserved.