Distributed Matching Engine for Scalable Trading
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current systems for electronic matching and trading of items between users face inefficiencies in managing distributed order books and communication across multiple servers, leading to complexities in executing trades and maintaining order integrity.
Innovation Solution
A distributed trading/matching system is implemented, where each server maintains a localized order book for items it is interested in, with multicast communication over specific ports for bid and offer orders, allowing for decentralized and scalable trading operations across multiple servers.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a centralized matching system is used to ensure order integrity, then trade execution reliability is improved, but system complexity and communication overhead increase
Solution Approach 1:
The centralized matching system is segmented into multiple distributed matching engines, each capable of independently matching orders. The order book is divided into multiple partitions distributed across different servers. This segmentation maintains reliability through redundancy while reducing the complexity of any single matching engine and enabling parallel processing.
Solution Approach 2:
A message bus or event-driven communication layer acts as an intermediary between distributed matching engines and order book managers. This intermediary standardizes communication protocols, reduces direct point-to-point complexity, and maintains system coherence through event-driven architecture without requiring complex synchronous coordination.
2Productivity
If multiple servers maintain localized order books to improve scalability, then system throughput increases, but data consistency and order integrity become more difficult to maintain
Solution Approach 1:
The order book is segmented into multiple independent partitions, each maintained by a different server or matching engine. Each partition can be updated and processed independently, enabling parallel order matching and improving throughput. Consistency is maintained through event-driven synchronization and version vectors that track state across partitions.
Solution Approach 2:
The system implements feedback mechanisms where matching results and order book state changes are published as events that other components can subscribe to. Version vectors and sequence numbers provide feedback on the state of each partition, enabling detectors to identify and resolve inconsistencies while maintaining overall system consistency.
3Reliability
If centralized communication protocols are used to ensure order integrity, then trade reliability is improved, but communication overhead and latency increase
Solution Approach 1:
Each matching engine maintains a localized view of the order book relevant to its jurisdiction or item type, eliminating the need for all engines to communicate every state change. Local matching decisions are made independently based on local state, reducing communication latency. Only final match results and state changes are communicated to other nodes.
Solution Approach 2:
An event-driven message bus serves as an intermediary that enables asynchronous communication between matching engines and order book managers. This intermediary decouples direct communication requirements, allowing components to process events at their own pace without blocking, thus reducing latency while maintaining reliability through event logging and acknowledgment mechanisms.
Data Source
AI summary
A system includes a plurality of servers that are configured to execute a distributed matching system for the trading of one or more items.
