Click here to Skip to main content
15,887,746 members
Articles / Web Development / Apache
Tip/Trick

Data Push technologies for stock trading systems

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
6 May 2013CPOL5 min read 10.3K   1  

Introduction

A stock trading system was taken as a case study where real time market updates as well as online refresh of transaction data requires implementation of push technologies. This evaluation was intended for coming up with the best possible solution in terms of speed, initial loading, dependencies required to be installed and memory utilization across browsers. The technology evaluated must work across platforms and across browsers. The below mentioned approaches are tested on IE, Firefox, Chrome and Opera.

This document describes the evaluation methodologies and results for the various data push technologies on the internet. Data pushing refers that the client receives data updates in an asynchronous manner at server's discretion, generally after expressing interest in a certain type of information (subscription). In other words, the client becomes a passive part of the system, receiving updated information as soon as it is available on the server by just subscribing to it only once during a session.

The following data push technologies were evaluated

  • Java Applet
  • Flex component (SWF file)
  • Light Streamer

A server developed in .NET which generated random price for a script and sent data via TCP/IP was used for evaluation of both java applet and flex based techniques.

The symbols were stored in the hash table from where the server fetched the symbol, generated the random tick and sent the data to the client on a TCP socket continuously.

Java Applet

Approach 1

A Java Applet was developed in which a socket connection was opened that read data from TCP/IP socket and updated that data within applet. The corresponding .jar file was included in the HTML page.

Approach 2

A Java Applet was developed in which a socket connection was opened that read data from TCP/IP. The corresponding jar file was included in the HTML page. A JavaScript function  in HTML page called the applet function continuously and updated the data in HTML Page.

Flex

Approach 1

A Flex application was developed in which a socket connection was opened, that read data from TCP/IP and updated that data in Flex supported mx:Datagrid [Flex Control].The application was compiled into an swf file. The swf file was included in the HTML page.

Approach 2

A Flex application was developed in which a socket connection was opened that read data from TCP/IP and called a JavaScript function written in HTML page. The application was compiled into an swf file. The swf file was included in the HTML page. The .swf file should be on the same webserver

Light Streamer

Light streamer runs on any platform compatible with Java std edition 1.4.2 or greater .   Java SE 6 is recommended for best performance. Light streamer server should be set up on same machine as web server .Light streamer is able to update the information shown on an HTML page without having to reload it, and above all, without having to add anything" extraneous", such as a Java applet or plug-ins of any kind.

The .NET Server sends the data to the Light streamer server through a socket connection.

The Light streamer server pushes the data to the html page through http connection using an     adapter, the adapter resides with the light streamer server and contains the details of request reply ports and notify port. The html page is enabled with java script , configured with the adapter to receive data from the light streamer server. Every time new data available in the light streamer server is pushed to the html page through the adapter.

(Light Streamer is tested with free version called Moderato)

Performance

  • Data updates were observed faster in flash as compared to java applet for the same no of symbols.
  • The User Interface was updated faster in case of flex component as compared to Java applet.
  • The CPU utilization was directly proportional to the number of scrips and ticks/sec.
  • The figures below are derived using 50 symbols and 10 ticks/sec

Parameters

Java Applet

Flex

LightStreamer

Plug In

JVM

Flash Player 9 or above

No plugin required

Plug In Size

10 MB

400 KB

Web Server

Apache

IIS/Apache

Apache

Files at webserver

.jar file should reside on webserver

.swf file  and crossdomain.xml should reside on webserver

One Light Streamer  java adapter should be on Web Server

 

Approach1

Approach2

Approach1

Approach2

Memory Utilization

33,388 KB

Cert reqd

46,172 KB

28,756 KB

24,844 KB

CPU

30 %

Cert reqd

50 %

30 %

35%

The max no of ticks that can be handled are 92 ticks/sec at a CPU utilization of 50%.

Recommendation

From the above table Flex component approach 2 seems to be the most obvious choice.

Light streamer doesn’t require any plug-in on the client side but require an additional light streamer server module on the server side which means an additional point of failure. The commercial version of Light Streamer would incur additional costs.

Plug-in size in case of flash is much smaller as compared to Java applet. Also Adobe claims a very heavy installation base for flash which is not the case for JRE. Flex approach 1 can be considered if the UI is planned in Flex however as in most the cases if the UI is plain HTML JavaScript combo Flex approach 2 is ideal.

Java applets perform poor as compared to Flex and pose security issues concerning certificates. In Java applet approach 2 HTML page continuously requests Java Applet for data hence this is not purely a push technology. The .jar file should reside on webserver.

Other alternatives available are HTML5 sockets but those are yet to be widely accepted and are not supported on IE browsers. Silverlight has support for sockets but Microsoft is soon going to stop the support of the same in favour of HTML5 , further Silverlight calls for a heavy plugin and is not widely installed. Also Silverlight will pose some cross platform issues and hence are not considered in this evaluation.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --