• Stars
    star
    145
  • Rank 254,144 (Top 6 %)
  • Language
    Java
  • License
    Other
  • Created almost 11 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Falcon, the open source ultra low-latency FIX engine for Java

Falcon

Falcon is a high performance, low latency FIX engine for the JVM. It provides an API that enables FIX connectivity for both buy side and sell side applications such as trading systems and order management systems.

The engine is designed to avoid heap allocations on the TX and RX paths to avoid GC pauses that are disastrous for low-latency applications. The engine is packed with other optimizations such as avoiding querying the system clock for every message and open-coding formatting and parsing functions where the JRE allocates memory implicitly.

Falcon is able to achieve 8 µs RTT on when running the latency tester client and server on the same machine.

Features

  • Zero-copy, non-blocking, low-latency NIO networking
  • Low heap allocation rate in the FIX engine core
  • Small memory footprint for session and message data structures

Example

An example application that sends 100000 NewOrderSingle messages looks like this:

import static java.net.StandardSocketOptions.*;
import java.nio.channels.*;
import java.net.*;
import java.nio.*;

import static falcon.fix.MessageTypes.*;
import static falcon.fix.Versions.*;
import static falcon.fix.Tags.*;
import falcon.fix.*;

public class Example {
  public static void main(String[] args) throws Exception {
    SocketChannel socket = connect("localhost", 7070);

    Session session = new Session(socket, FIX_4_2, "HERMES", "INET");

    session.updateTime();

    session.send(new Message.Builder(Logon)
        .add(new Field(EncryptMethod, "0" ))
        .add(new Field(HeartBtInt,    "30"))
        .build());

    Message newOrder =
      new Message.Builder(NewOrderSingle)
          .add(new Field(EncryptMethod, "0" ))
          .add(new Field(HeartBtInt,    "30"))
          .build();

    for (int i = 0; i < 100000; i++) {
      if ((i % 10000) == 0) {
        session.updateTime();
      }
      session.send(newOrder);
    }

    session.updateTime();

    session.send(new Message.Builder(Logout).build());

    socket.close();
  }

  private static SocketChannel connect(String host, int port) throws Exception {
    InetSocketAddress addr = new InetSocketAddress(host, port);
    SocketChannel socket = SocketChannel.open();
    socket.configureBlocking(false);
    socket.setOption(TCP_NODELAY, true);
    socket.connect(addr);
    socket.finishConnect();
    return socket;
  }
}

Performance

The FIX engine has been measured to have 8 µs RTT for a loopback ping-pong test where client sends a NewOrderSingle message and waits for an ExecutionReport message to arrive. The numbers include the time spent in Linux TCP/IP stack and the loopback device.

To reproduce the results, first download and build Libtrading. Then start the FIX performance test server:

$ taskset -c 0 tools/fix/fix_server -m 1 -p 7070

Finally, run the Falcon latency tests:

$ ./falcon-perf-test/bin/falcon-perf-test 1000000
87693.5 messages/second
min/avg/max = 9.8/11.4/19935.3 µs
Percentiles:
  1.00%: 10.15 µs
  5.00%: 10.51 µs
 10.00%: 10.61 µs
 50.00%: 11.12 µs
 90.00%: 11.90 µs
 95.00%: 13.27 µs
 99.00%: 14.53 µs

License

Copyright © 2013-2015 Pekka Enberg and contributors

Falcon is distributed under the 2-clause BSD license.

More Repositories

1

limbo

Limbo is a work-in-progress, in-process OLTP database management system, compatible with SQLite.
Rust
645
star
2

awesome-low-latency

Patterns and resources of low latency programming.
314
star
3

fjord

Fjord, F# programming language for the JVM.
Java
200
star
4

helix

Helix, a market data feed handler for C and C++.
C++
104
star
5

mvcc-rs

Optimistic multi-version concurrency control (MVCC) for main memory databases, written in Rust.
Rust
76
star
6

awesome-os

A curated list of resources on operating system design and implementation.
75
star
7

hiisi

Hiisi is a proof of concept libSQL written in Rust following TigerBeetle-style with deterministic simulation testing.
Rust
71
star
8

unix-history

History of UNIX Design and Interfaces
57
star
9

hornet

Hornet, a JVM optimized for low-latency applications.
C
54
star
10

vsr-rs

Viewstamped Replication for Rust
Rust
38
star
11

go-osxhv

Go bindings for the OS X Hypervisor.framework API
Go
36
star
12

pstore

pstore, a high-performance, read-optimized database system.
C
25
star
13

ustat

ustat - an unified system stats collector tool
Go
23
star
14

sphinx

Sphinx is a fast in-memory key-value store, compatible with Memcached.
C++
20
star
15

ycsb-rs

A Rust port of Yahoo! Cloud Serving Benchmark (YCSB)
Rust
20
star
16

linux-networking

Notes on Linux network internals
18
star
17

godoom

A Doom clone written in OpenGL and Go.
Go
17
star
18

awesome-databases

Databases are awesome! 🕶
17
star
19

wolf

Wolf, a raycasting engine for pseudo 3D games.
C
13
star
20

nasdaq-omx-simulator

NASDAQ OMX simulator
Go
12
star
21

bwtree-rs

Bw-Tree for Rust
Rust
12
star
22

legacy-free-x86

OS development resources for legacy-free x86 hardware.
7
star
23

classpath

Pekka's GNU Classpath development tree
Java
7
star
24

duhview

ANSI art viewer written in C and SDL
C
6
star
25

awesome-serverless

Serverless is awesome! 🕶
6
star
26

go-scylla-api

Go library for accessing the Scylla REST API
Go
6
star
27

bitmex-api

BitMEX API for C++
C++
6
star
28

groovyfmt

groovyfmt is a tool to automatically format your Groovy code.
GAP
6
star
29

multiplayer-matchmaker

A multiplayer on-line game matchmaking server.
TypeScript
5
star
30

nasdaqomx-itch

Haskell implementation of NASDAQ OMX Nordic ITCH
Haskell
5
star
31

spirit

Rust
4
star
32

posixbench

POSIX latency and energy-efficiency benchmark suite
C++
3
star
33

btct

Bitcoin terminal for monitoring real-time Bitcoin quotes on the command line.
Ruby
3
star
34

alp

Alp, a text-mode email client.
Ruby
2
star
35

scyllactl

Go
2
star
36

yetanothercore

Yet another RISC-V CPU core
C
2
star
37

scylla-fedora

1
star
38

esparser-rs

JavaScript and TypeScript parser for 🦀
Rust
1
star
39

virt-net-perf

1
star
40

xmlindent

C
1
star