HTML5 M ICHEL A NDR CTO MAN @ SAXOBANK . COM @michelandre71 AGENDA - - PowerPoint PPT Presentation

html5
SMART_READER_LITE
LIVE PREVIEW

HTML5 M ICHEL A NDR CTO MAN @ SAXOBANK . COM @michelandre71 AGENDA - - PowerPoint PPT Presentation

H IGH PERFORMANCE TRADING APPLICATIONS USING HTML5 M ICHEL A NDR CTO MAN @ SAXOBANK . COM @michelandre71 AGENDA Saxo Bank Primer: Setting the Scene Why application performance matters Defining performance .


slide-1
SLIDE 1

HIGH PERFORMANCE TRADING APPLICATIONS USING HTML5

MICHEL ANDRÉ

CTO

MAN@SAXOBANK.COM

@michelandre71

slide-2
SLIDE 2

AGENDA

  • Saxo Bank Primer: Setting the Scene
  • Why application performance

matters

Defining “ performance” .

  • Factors affecting performance

R eal and self-imposed constraints

  • Case-Study

Presenting SaxoTrader GO

Walk through of architectural & technical choices (Magically it ended up with 7 steps to… .)

slide-3
SLIDE 3

S AXO BANK: S ETTING THE S CENE

EMPLOYEES >1300 NATIONALITIES 59 S POKEN LANGUAGES IN THE BANK 40 OFFICES 25 countries

  • NO. OF FX TRADES

PER DAY 170,000 MAX NO TRADES / S ECOND >1300 MAX NO PRICES / S ECOND >400 000 DAILY AVERAGE TURNOVER 100 billion DKK

  • NO. OF COUNTRIES

WITH RETAIL CLIENTS 190 S AXOTRADER LANGUAGES 25 GROS S PROFIT <15 cents per 1,000 US D traded FINANCIAL INS TRUMENTS more than 30,000 RECEIVED PRICES PER DAY 5-6 billion MAX CONCURRENT US ERS ~15.000.

slide-4
SLIDE 4

S AXO BANK TECHNOLOGY & BUS INES S MODEL

PROVIDER OF PRICES AND PRODUCTS SAXO BANK CLIENTS

12

Large International Banks

50

Exchanges

NASDAQ, NYSE, OMX, LSE, GLOBEX, EUREX, ETC.

25

Other Trading Facilities

CHI-X, TURQUOISE, ETC.

SAXO BANK’S ONLINE TRADING PLATFORM

Private White Label Clients

BANKS, BROKERAGES, ETC. USING SAXO BANK’S TRADING PLATFORM

Institutions/ Corporates

ASSET MANAGERS, FINANCIAL ADVISORS, INTRODUCING BROKERS

slide-5
SLIDE 5

PERFORMANCE… AND WHY IT MA TTERS ..

slide-6
SLIDE 6

PERFORMANCE

  • R

esponse Times: The 3 Important Limits: (Jakob Nielsen 1993)

– 0.1 second: the limit for the user feeling that the system reacts

instantaneously

– 1.0 second: the limit for the users flow of thought. – 10 seconds: the limit for keeping the user’s attention.

  • Amazon reports 100 ms in page load time cost 1%

in sales (2006).

  • Google experiment showed 0.5 s increased delay causes 20%

drop in traffic. (2006)

  • Nearly 60%
  • f web users say they expect a website to load on their mobile

phone in 3 seconds or less… 50% are willing to wait 5 seconds or less for an application to load before exiting (Compuware, 2011)

  • Tabb group on trading systems: 5 ms latency could result in 1%

drop in flow. (2008)

slide-7
SLIDE 7

Liquidit y Liquidit y Liquidit y Liquidit y Liquidit y

  • 1. 07546/ 1. 07566
  • 1. 07546/ 1. 07566

TRADING CURRENCY – TRADING ON QUOTE

slide-8
SLIDE 8

TRADING CURRENCY – TRADING ON QUOTE

Liquidit y Liquidit y Liquidit y Liquidit y Liquidit y

  • 1. 07546/ 1. 07566
  • 1. 07546/ 1. 07566

BUY 25. 000 EURUSD @

  • 1. 07566
slide-9
SLIDE 9

TRADING CURRENCY – TRADING ON QUOTE

Liquidit y Liquidit y Liquidit y Liquidit y Liquidit y

  • 1. 07546/ 1. 07566
  • 1. 07546/ 1. 07566

BUY 25. 000 EURUSD @

  • 1. 07566
slide-10
SLIDE 10

S O FOR US PERFORMANCE MEANS

And remember people are trading with real money in fast moving markets, so psychologically they must also feel that they have the best tool and control.

(Price) Lat ency: User can accept t he lat est price, so his t rade will not get rej ect ed (~300-500 ms). Applicat ion Load Time: From st art ing app (hit t ing URL) t o login complet ed and app ready: Fast enough t o keep t he client around. (<5 s). UI R esponsiveness: Visual feedback on user act ion in applicat ion, it should feel immediat e (~100 ms).

  • -- but scrolling must also be smoot h (~40 mS)

Syst em R esponsiveness: Visual feedback on user act ion involving whole syst em (such as order confirmat ion) (<< 1s).

slide-11
SLIDE 11

F ACTORS AFFECTING PERFORMANCE (PHYS ICAL)

Liquidity

Copenhagen

Liquidity Liquidity Liquidity

New York Singapore Sydney Copenhagen Singapore Sydney

  • Connect….
  • Fetch login page
  • Login
  • Fetch Application
  • Fetch User Data
  • Start Trading

0 km ~ 0 ms round-trip 9996 km ~ 67 ms round-trip 15992 km ~ 107 ms round-trip

*) Unrealistically best case J based on speed of light in direct point to point. Copenhagen

slide-12
SLIDE 12

F ACTORS AFFECTING PERFORMANCE (S ELF IMPOS ED)

Strategic decision to build on REST based OpenAPI – and dogfood

Speed APX ”Purity”

§ Need to support White Label Customizations (Logos, Layouts,

Configurability)

§ There is significant business logic in the application and we cannot afford to

build both a web and multiple native applications.

§ And keep them updated!

slide-13
SLIDE 13

CAS E S TUDY S AXOTRADER GO…

slide-14
SLIDE 14

AN APPLICA TION WITH MANY F AS T CHANGING ELEMENTS ..

slide-15
SLIDE 15

WHA T HAPPENS ?

Request to load application

DNS, SSL Connect Receive App Receive referred resource DNS, SSL Connect DNS, SSL Connect Receive referred resource Receive referred resource

Connect to service layer

User Dat a DNS, SSL Connect St reaming Subscribe t o dat a

Now the application is ready

slide-16
SLIDE 16

CURE 1: GET RID OF THE WEB S ER VER

  • Traditionally slow as we depend on

dynamic data

  • Often hard to cache
  • We can’t get rid of the latency to the

data center

Output Web- request

Pre build package of html/js/css App separated out from dynamic data

  • Very fast as it is just static resources
  • Caches well at multiple stages: Server,

CDN Edge Node and in browser cache locally.

Output Web- request

Building web page DB Service

Traditional Web Page/App Delivery

slide-17
SLIDE 17

CURE 2: US E A CDN WITH S S L OFFLOADING

  • Large application vs small sets of dynamic data
  • Initial load of application depends on range of network related factors

DNS, connect time, SSL connection time, Network package negotiation (TCP Initial Window Size)

Power Save on phones is a separate problem

The network route to your servers may not be the most efficient possible

Prefetch may “ warmup” connections.

<link rel=“prefetch” href=https://streaming.saxotrader.com/openapi/isalive”>

Hack J and not always supported where you need it the most.

  • Engaging with a CDN can “ auto” solve a lot of these issues
slide-18
SLIDE 18

CURE 2: US E A CDN WITH S S L OFFLOADING

slide-19
SLIDE 19

CURE 2: US E A CDN WITH S S L OFFLOADING

slide-20
SLIDE 20

Trading

CURE 3: US ING S TREAMING TECHNOLOGY TO PUS H OUT UPDA TES

Open API Servers

High performance message bus

Internal Network

Request Response Subscribe Snapshot Deltas from Snapshot are calculated & streamed

Stream of Δs

D

Ref Data Performance Portfolio Streaming Servers

slide-21
SLIDE 21

CURE 4: COMPROMIS ING ON RES PONS IVE DES IGN

Y

  • u want to optimize for download size

Y

  • u want to optimize for number of http

requests Y

  • u can make a website look nice across all

devices with R WD

Do you want t o load CSS f or all plat f orms always?

Is it really t he same app scaled down/ up or a dif f erent one built f rom t he same building blocks?

If you have a lot of code you may have t o have dif f erent delivery approach depending on what t he consuming device can handle, reducing t he benef it of RWD

We have chosen to have 3 different applications bundled for desktop, tablets and phones

RWD ensures t hat we handle t he dif f erent f orm f act ors wit hin each cat egory

Often understood as:

  • Have CSS rules for scaling (and rearranging UI

elements)

  • Conditionally load images/icons of different size
  • Have one code base that dynamically scales
slide-22
SLIDE 22

EXAMPLE 1: S AXOTRADER GO FOR DES KTOP

slide-23
SLIDE 23

EXAMPLE 2: S AXOTRADER GO FOR MOBILE

User defined watch-list Positions in the market Charts and financial studies

slide-24
SLIDE 24

THROUGHOUT THIS … REMEMBER THE Y

  • S

LOW RULES . *

*) http://yslow.org/ And remember, there is always a balance J

Also remember:

  • This is hard work…
  • But it pays off
slide-25
SLIDE 25

CURE 5: US E THE APPLICA TION CACHE

  • Intended for “ offline” applications
  • We use it to cache the entire static part of the

application

  • It performs better because all the application has to

do is check whether there are changes to the manifest file, rather than all other resources

  • NOTE: Hard to force update a cached application.

The user can get stuck

slide-26
SLIDE 26
  • We receive a lot of updates from the server
  • The user needs to be able to interact with the application instantly
  • Updating the DOM is expensive. Even more so if it involves layout
  • Do you know the framerate your application can maintain?
  • R

emember the chart? It represents completely different challenges

CURE 6: TREA T THE APPLICA TION AS IF IT WAS A GAME J

slide-27
SLIDE 27

CURE 6: TREA T THE APPLICA TION AS IF IT WAS A GAME J

slide-28
SLIDE 28

CURE 6: TREA T THE APPLICA TION AS IF IT WAS A GAME J

slide-29
SLIDE 29

CURE 6: TREA T THE APPLICA TION AS IF IT WAS A GAME J

slide-30
SLIDE 30

CURE 6: TREA T THE APPLICA TION AS IF IT WAS A GAME J

slide-31
SLIDE 31

CURE 7: MEAS URE CONTINUOUS LY AND IN DEPTH

Externally using Dynatrace

slide-32
SLIDE 32

CURE 7: MEAS URE CONTINUOUS LY AND IN DEPTH

Externally using Dynatrace In App using custom tools

slide-33
SLIDE 33

CURE 7: MEAS URE CONTINUOUS LY AND IN DEPTH

Externally using Dynatrace In App using custom tools At API layer using LogParser + inhouse tools

slide-34
SLIDE 34

CURE 7: MEAS URE CONTINUOUS LY AND IN DEPTH

Externally using Dynatrace In App using custom tools At API layer using LogParser + inhouse tools

slide-35
SLIDE 35

In Conclusion:

Performance is critically important, especially in trading applications The combination of HTML5 and (Open)API’s is attractive from a business and technology perspective. Building a high performance HTML5 application is entirely possible! But you must make some architectual decisions (such as push technology) And you must pay attention to detail. All the time.