• Stars
    star
    314
  • Rank 128,740 (Top 3 %)
  • Language
  • Created almost 2 years ago
  • Updated 11 months ago

Reviews

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

Repository Details

Patterns and resources of low latency programming.

Awesome Low Latency

Low latency programming is increasingly important across a variety of use cases. Still, many of the tips and tricks of low latency are only part of developer folklore. This document attempts to codify that knowledge for people to (re)discover the art of low-latency programming.

Patterns

How to Measure Latency Correctly

  • Latency is a distribution
  • Avoid coordinated omission

Avoid Data Movement

  • Co-locate compute and data e.g. Processing-In-Memory or Processing-Near-Memory
  • Replicate data for faster access
  • Maximize cache hit rate
  • Control memory access patterns

Avoid Work

  • Avoid dynamic memory management
  • Avoid demand paging to prevent memory thrashing e.g. by using larger memory pages (hugepages on Linux, superpages on FreeBSD, ...)
  • Avoid as much work as possible (for example, avoid function call overhead by using inlining)
  • Avoid CPU intensive computation.

Avoid Waiting

  • Partition data to avoid sharing (and, therefore, synchronization)
  • Make shared data structures read-only (when possible)
  • Reduce head-of-line blocking
  • Avoid context switching
  • Use wait-free data synchronization
  • Use busy-polling instead of wakeups
  • Disable Nagle's algorithm
  • Use non-blocking I/O

Hide Latency

  • Parallelize requests to different services
  • Request hedging (send redundant requests to multiple replicase, use response from fastest one)
  • Use optimized SIMD instructions for suitable problems
  • Multiprocessing and multithreading

Tune for Low Latency

  • Use preemptible kernel
  • Interrupt and process affinity
  • Watch out for bad device drivers

Advanced Topics

  • Use kernel-bypass networking such as DPDK or XDP
  • Use hardware offload with accelerators and FPGA

Blogs

Publications

Conferences

More Repositories

1

fjord

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

falcon

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

helix

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

mvcc-rs

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

awesome-os

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

unix-history

History of UNIX Design and Interfaces
57
star
7

hornet

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

vsr-rs

Viewstamped Replication for Rust
Rust
38
star
9

go-osxhv

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

pstore

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

ustat

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

sphinx

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

ycsb-rs

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

linux-networking

Notes on Linux network internals
18
star
15

godoom

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

awesome-databases

Databases are awesome! ๐Ÿ•ถ
17
star
17

wolf

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

nasdaq-omx-simulator

NASDAQ OMX simulator
Go
12
star
19

bwtree-rs

Bw-Tree for Rust
Rust
12
star
20

legacy-free-x86

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

classpath

Pekka's GNU Classpath development tree
Java
7
star
22

duhview

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

awesome-serverless

Serverless is awesome! ๐Ÿ•ถ
6
star
24

go-scylla-api

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

bitmex-api

BitMEX API for C++
C++
6
star
26

groovyfmt

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

multiplayer-matchmaker

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

nasdaqomx-itch

Haskell implementation of NASDAQ OMX Nordic ITCH
Haskell
5
star
29

spirit

Rust
4
star
30

posixbench

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

btct

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

yetanothercore

Yet another RISC-V CPU core
C
2
star
33

alp

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

scyllactl

Go
2
star
35

scylla-fedora

1
star
36

esparser-rs

JavaScript and TypeScript parser for ๐Ÿฆ€
Rust
1
star
37

virt-net-perf

1
star
38

xmlindent

C
1
star