Alexandra Tessari from HSBC explains how in the world of electronic trading, the ability to process buy and sell orders swiftly and accurately is paramount. Over the past few years, HSBC’s Equities technology teams developed an in-house trading platform that significantly boosted trade flow and profits. However, the original design patterns and technology choices began to show limitations. To address these issues, HSBC rewrote its trade and order management processes to enhance trade throughput, reduce latency, and improve resiliency.
The new system was developed in Java, utilizing an event bus and command pattern with a sharding model. This approach focused on performance by bypassing the kernel network stack and employing GC-free techniques. Specialized network cards, Precision Time Protocol (PTP) interfaces, and other hardware devices were used to meet and measure low latency requirements. The primary network protocol was UDP, and the Aeron open-source library was used for multicast messaging in colocated data centers with trading exchanges.
Current Order Management System (OMS) Limitations
Alexandra Tessari explains that the journey began with an examination of HSBC’s current order management system (OMS), which was built on the Disruptor pattern. This design, once cutting-edge, facilitated high throughput and low latency asynchronous event processing. However, as the demand for more orders and support for strategic functionalities grew, the inherent limitations of the single-threaded OMS design became apparent. These included potential bottlenecks and inefficiencies in failover processes, which could impede order flow and scalability. Thus, a new design was necessary to overcome these challenges and support future growth.
Transition to a New Architecture
To address these issues, HSBC transitioned to a new architecture that leveraged an event bus pattern with sharding, supported by Java and advanced binary protocols like SBE (Simple Binary Encoding). This architecture not only improved scalability by allowing multiple services to communicate efficiently but also enhanced performance through the use of GC-free techniques and off-heap memory management. By focusing on predictable memory access patterns and minimizing garbage collection, HSBC aimed to achieve microsecond-level latency for order processing, which was critical for maintaining a competitive edge in financial markets.
Integration of Precision Time Protocols and Network Accelerators
A key component of this transformation was the integration of precision time protocols and network accelerators like Solarflare. These technologies enabled HSBC to synchronize servers at a nanosecond level and bypass traditional kernel limitations, thus reducing latency significantly. By employing Aeron, an open-source message transport library, HSBC ensured reliable and fast communication across their network, facilitating high throughput and low latency interactions between different components of their system. This approach also allowed for effective congestion control and back-pressure management, crucial for maintaining system stability under heavy load.
Importance of Thoughtful System Design
Alexandra Tessari emphasized that the journey to build a scalable, low latency messaging platform was marked by strategic technology choices and innovative design principles. By embracing Java, adopting advanced protocols, and leveraging cutting-edge hardware solutions, HSBC was poised to enhance its electronic trading capabilities significantly. This initiative not only addressed current limitations but also laid a robust foundation for future growth and adaptability in the fast-paced world of financial trading. As HSBC continued to refine their approach, the focus remained on delivering an efficient, resilient, and high-performance trading environment for their global clientele.