Thread 1: Input queue. (Orders like add, modify and cancel)
Receives incoming orders via AMQP and puts them on a FIFO buffer for the matching engine to read atomically
Thread 2: Matching Engine
Reads from input queue, then performs an order execution, then writes transpired events (add, modify, cancel, and executions) to the output queue. Every so often it will perform a garbage collect to clear memory from the tree/cache
Thread 3: Output queue
Takes events written to the output queue and publishes them via UDP broadcasts
We need to have locks and/or atomics on these to make this happen
Current thread structure:
Thread 1: Input queue. (Orders like add, modify and cancel) Receives incoming orders via AMQP and puts them on a FIFO buffer for the matching engine to read atomically
Thread 2: Matching Engine Reads from input queue, then performs an order execution, then writes transpired events (add, modify, cancel, and executions) to the output queue. Every so often it will perform a garbage collect to clear memory from the tree/cache
Thread 3: Output queue Takes events written to the output queue and publishes them via UDP broadcasts
We need to have locks and/or atomics on these to make this happen