Introduction Kevin has over 20 years experience of working within - - PowerPoint PPT Presentation

introduction
SMART_READER_LITE
LIVE PREVIEW

Introduction Kevin has over 20 years experience of working within - - PowerPoint PPT Presentation

Introduction Kevin has over 20 years experience of working within financial markets technology including Robert Fleming, LSE, Salomon Brothers and HSBC. Kevin helped to establish the FIX protocol in Europe. His first FIX engine was given away


slide-1
SLIDE 1

Introduction

Rupert Smith is a Java programmer, who started out tinkering at the low-level end of things; Assembler and C. He first worked on messaging software as a contributor to the Apache Qpid implementation of AMQP. He is currently working for Rapid Addition which, with its low-latency focus, is a fertile place to mix ideas from his background. He studied Computer Science at Cambridge University and maintains an interest in compiler development, particularly for logic based languages. His main hobbies are camping and nature conservation. Kevin has over 20 year’s experience of working within financial markets technology including Robert Fleming, LSE, Salomon Brothers and HSBC. Kevin helped to establish the FIX protocol in Europe. His first FIX engine was given away as a learning aid that helped many enterprises further their knowledge of FIX. Kevin is the designer of the FIX Repository for FIX Protocol Limited, Co-chairs the Global Technical Committee, and is an active member of the Global Steering Committee. He is the lead Expert Group member, UK Government Foresight Committee looking at the Future of Computer Based Trading.

slide-2
SLIDE 2

Introduction

Rationale Origin Road to Gen Zero Details

slide-3
SLIDE 3

Box Trade - $100

USD GBP EUR 100

1

USD/EUR = 1.3158 EUR/GBP = 1.1875 USD/GBP = 1.5625 Ignoring spreads, commissions and transaction costs

slide-4
SLIDE 4

Box Trade - $100

USD GBP EUR 100

1

100

2

76

2

USD/EUR = 1.3158 EUR/GBP = 1.1875 USD/GBP = 1.5625

slide-5
SLIDE 5

Box Trade - $100

USD GBP EUR 100

1

100

2

76

2

76

3

64

3

USD/EUR = 1.3158 EUR/GBP = 1.1875 USD/GBP = 1.5625

slide-6
SLIDE 6

Box Trade - $100

USD GBP EUR 100

1

100

2

76

2

76

3

64

3

64

4

101

4

USD/EUR = 1.3158 EUR/GBP = 1.1875 USD/GBP = 1.5625

Profit = $1

slide-7
SLIDE 7

Origin

Wrote a repository driven engine initially used with BizTalk What is the repository? Looked a code generation to improve Already one of the fastest engines around GC identified as major hurdle .Net initiative to remove

slide-8
SLIDE 8

Latency vs Load and Throughput vs Load

Latency Throughput max throughput min latency saturation point saturation point Load Load

If you want good latency, you must have excess capacity.

slide-9
SLIDE 9

Distribution of Latencies

100% 0% baseline Distribution Density Function Cumulative Distribution Function

Lower the baseline. Tighten the tail.

slide-10
SLIDE 10

The 'Algo' Trading Test

Algo box MD box Exchg box TipOff box Tap Switch

Timetamp first bit (+ constant delay) Latency = T2 - T1 = (T2 + C) - (T1 + C) fix0_n Market Data and Executions fix1_n Orders

Why?

Order and Exec Report can be matched up by Client Order Id. Market Data and Order have no built in correlation. 1001.000 -> BUY 1 1002.000 -> BUY 2 ... 1001.001 ... 1001.005

  • 2001.000 -> BUY 1

... 5 'stocks' 5 ticks/cycle

slide-11
SLIDE 11

End to End Time Budget

NIC NIC NIC NIC

DMA

Interrupt TCP

Serialize

Deserialize

S e r i a l i z e

Deserialize

Eth Eth Eth Eth

DMA DMA DMA

TCP

TCP

TCP 2.5 2.5 1 14 2 5 3 2 1 2.5 2.5 2.5 1 1 5 3 1 1 2.5

1G on 2.8 GHz Nehalem, built in NIC 1G on 2.8 GHz, SolarFlare and 'open onload'

slide-12
SLIDE 12

Jitter and Garbage Free Code

http://tinyurl.com/69m7xz JavaWorld article

  • n Javolution

Compute FFT of Complex

  • numbers. Requires lot of

intermediate values; a source of garbage.

Genzero Rules:

1) Actively manage any resources used in program, object pools etc 2) Start up – GC permitted 3) No GC in steady state phase of program

slide-13
SLIDE 13

FIX is ASCII

8=FIX.4.2 | 9=192 | 35=X | 49=FEED | 56=ALGO | 34=7 | 52=20120308-00:51:52.303 | 262=subscribe:A000 | 268=2 | 279=1 | 269=1 | 278=23 | 55=A000 | 270=0.001 | 271=1000 | 346=1 | 290=1 | 279=1 | 269=0 | 278=24 | 55=A000 | 270=0.101 | 271=1000 | 346=1 | 290=1 | 10=186 |

Subtract ASCII '0' Multiply by 10 Divide by 10, take modulo. Add ASCII '0'

Avoid using java.lang.String for string processing.

slide-14
SLIDE 14

Zero Copy I/O, how real is it?

JVM

NIC NIC User Kernel

read() write() readv() writev()

Direct Buffer Heap Buffer TCP Packets Socket Buffer

There may be copying. Access to byte[] vs getByte()/setByte(). Java nio provides API for zero-copy vectored I/O.

slide-15
SLIDE 15

SolarFlare Effect of 'onload' (polling)

slide-16
SLIDE 16

RA Cheetah vs QuickFixJ

GenZero programming differences: Experience tells on calls to avoid etc More tests Longer testing period, effectively soak tests, a 30 second test will not show up GC that happens every 120

slide-17
SLIDE 17

Intel Testing, 10G SolarFlare and Dell Everest

slide-18
SLIDE 18

FIX Engine Overview

TagValueVisitor MessageBuilder getBuffer() releaseBuffer() getBuffer() releaseBuffer() ReceiveHandler SendHandler Serializer Deserializer SocketsHandler

slide-19
SLIDE 19

FIX Engine - With Internal Queues

TagValueVisitor MessageBuilder ReceiveHandler SendHandler Deserializer Serializer SocketsHandler allocate seq no. allocate buffer position chunk messages by length allocate local seq no.

slide-20
SLIDE 20

FIX Engine - With Hardware Implementation

TagValueVisitor MessageBuilder ReceiveHandler SendHandler DMA DMA FPGA Card DMA Engine FIX Core TCP Stack