| With the development of global finance, electronic trading has become the major form of financial trading. Meanwhile the need for high performance and highly reliable system is more and more acute. Therefore as the important form of financial trading, matching system has to provide better performance and reliability.This dissertation studies how to build a robust matching system with high performance. Firstly I analyzed the overall design of the matching system and then determine the requirements. Secondly after analyzing matching engine part, I proposed a matching engine solution based on replicated memory state machine. To realize this solution, I studied design principles and consistency theory of distributed systems, divided matching system into three abstract layers (gateway layer, matching engine layer and database layer), and applied atomic multicast, lock-free-MQ-based pipeline matching, asynchronous data persistency, failure recovery and progress chasing techniques. Atomic multicast is used to guarantee efficient order replication and multicast. Lock-free-MQ-based pipeline matching improves the matching throughput. Asynchronous data persistency improves throughput and robustness of data persistency. Failure recovery quickly identifies failure and switches master server to provide high reliability using heartbeat packets. Progress chasing provides non-pause progress gap elimination. Finally I coded this solution as well as the control model of database matching model and conducted thorough analysis.The test data shows that, the new model can provide5times as much as the old model with the latency only about12%to it, and the new model can quickly detect and mask failure so that it can provide continuous service. In conclusion, the high available and high performance matching technology can enable organizations to provide steady service with high performance. |