마켓데이타와 RDMA

1.
월스트리트와 관련된 자료를 보면서 가졌던 의문.

“어떻게 초당 몇백만건의 데이타를 처리할까?”

항상 품었던 의문의 실타래를 풀기 위한 시작글입니다.(^^)
RegNMS는 미국증권시장에서 커다란 변화를 몰고온 핵심요인중의 하나입니다. 물론 정보기술이 놀랍도록 커다란 발전을 하였기 때문에 RegNMS를 기술적으로 뒷받침할 수 있었습니다. 반대로 RegNMS는 정보기술이 새로운 방향으로 발전하도록 하였습니다. HPC=High Performance Computing에 대해 자본시장이 관심을 가지기 시작하였기때문입니다. HFT를 설명할 때 미국시장에서 초당 처리하여야 하는 데이타량에 대해 말했습니다.? 옵션의 경우 2,000,000 Tick/Sec라고 하였고 주식시장의 경우 대략 1,000,000 Tick/Sec인 듯 합니다. 이런 데이타를 가장 빠른 시간내에 처리하여야 하는 현실적인 요구때문에 Wall Street에서 HPC에 관심을 보인 듯 합니다.

제가 이런 숫자를 가지고 몇 증권사 IT담당자에게 설명을 드렸더니 믿지를 못하는 눈치였습니다. 저도 CEP/ESP 제품소개서를 볼 때 초당 100,000~1,000,000을 처리한다는 말을 듣고 “설마~~”했지만? 자료를 확인하니까 사실이었습니다.

2.
한국에서 시세데이타를 처리하는 방식은 증권사마다 큰 차이가 없습니다.

코스콤을 통하여 받은 시세데이타를 대외계(FEP=Front End Processor)서버에 받아서 UDP 혹은 Multicast 합니다.? 시세데이타를 받아서 트레이딩서비스를 제공하는 서버들의 경우 시세를 처리하여 ISAM/Shared Memory/ MMDB/SAM형식으로 시세데이타를 쌓는 프로그램이 돕니다. 여기서 약간 차이가 발생합니다. ISAM/DBMS을 사용하는 대신 알티베이스와 같은 MMDB를 사용하는 경우입니다. 혹은 Memory-Based File System을 생성하여 ISAM과 같은 파일을 사용합니다. 물론 속도 향상을 위해서.

또한 Publish/Subscribe방식으로 데이타를 실시간 전송하기 위한 처리도 합니다. 이런 환경에서 트레이더 혹은 투자자가 접속을 하면 시세조회화면을 선택하면 Request/Reply방식으로 시세를 전송한 후 Pub/Sub방식으로 시세데이타를 메시징처리합니다.

이 때 각 서버(하드웨어 및 소프트웨어)의 성능은 초당 처리하여야 하는 시세데이타건수와 동시접속자수(동시접속자들이 조회하는 데이타의 특성에 영향을 받음)에 따라 달라집니다. 현재와 같은 구조속에서 초당데이타가 모든 시장을 더하여 몇 만건이상을 처리하기가 힘듭니다. I/O Bottleneck이 발생하여 CPU사용이 100%에 달합니다.

3
이제 HPC를 적용하여 백만건이상을 처리한다고 큰소리(?)치는 미국의 사례를 소개하도록 하겠습니다. 물론 한국과 같은 Home Trading System은 아닙니다. Prop Trader, Active Trader 혹은 Institutional Trader를 위한 시스템입니다. 그렇기 때문에 직접적인 비교는 힘들지만 한국의 증권IT를 혁신할 수 있는 아이디어는 제공하리라 생각합니다.

우선 RegNMS가 도입된 이후 마켓데이타문제를 해결하기 위해 어떤 방향으로 노력을 진행하였는지를 알아보도록 하겠습니다. 먼저 Hardware Acceleration이라는 방향입니다. 이부분은 하드웨어를 이용한 금융시스템의 성능향상이라는 글에서 자세하게 다뤘습니다.

? Hardware accelerated market data systems are heading towards us from two directions – the network layer up, and the application layer down. In the network camp we have Cisco AONS and Solace Systems, whose approach is to build the intelligence into the network layer. (Incidentally, the Cisco approach is not really one of hardware acceleration. Cisco is starting from a base of fast hardware, and integrating a software capability into routers).

In the application camp, contenders are reusing standard network technology, with a focus on the acceleration of applications sitting within the network fabric. It is this approach that is gaining early traction in the market dataspace, with solutions being offered by such firms as Tervela and Exegy. And the achievable performance speed-ups and latency reductions are truly staggering.

The secret ingredient is the FPGA ? Field Programmable Gate Array. Think of an FPGA as allowing developers to compile a highly parallelized version of their application directly into hardware, and to execute it with close to zero latency. One systems vendor we are working with has found that for market data processing, software executing on a 2GHz dual core CPU can be outgunned by a functionally equivalent FPGA implementation clocked at 100 MHz.
?Low-Latency Crowd Braces for Hardware Acceleration 중에서

Exegy는 FGPA,GPU기술, Multi-Core CPU기술등을 채택한 시스템입니다.

NVIDIA GPU (GTX 260) and programmed it using the CUDA (Compute Unified Device Architecture) tools, a Xilinx Virtex-4 LX80 FPGA and four dual-core 2.2 GHz AMD Opterons.

4.
그러면 Software Acceleration에 대하여 알아보도록 하겠습니다. 주인공은 NYSE Technologies입니다. 원래 Wombat Financial Software라는 이름이었지만 NYSE Euronext에 인수되면서 변경되었습니다.

일반적으로 TCP/IP를 사용할 경우 아래와 같은 데이타흐름때문에 CPU성능에 영향을 준다고 합니다.
사용자 삽입 이미지
이상과 같은 데이타? 복사는 latency, consume memory bus bandwidth의 사용을 늘리고 1 기가 이더넷을 기준으로 20~30%정도 CPU 사용이 늘어납니다. 10기가일 경우엔 CPU를 잡아먹을 정도가 됩니다.

RDMA를 적용할 경우 TCP/IP와는 다른 흐름을 보입니다. 이 때문에 CPU의 부하를 줄여서 성능개선을 이룰 수 있게 됩니다.

사용자 삽입 이미지

NYSE가 보유한 기술에 Voltaire에서 제공한 RDMA에 기반한 Messaging Accelerator를 더하여 위와 같은 성능을 구현하였습니다.
사용자 삽입 이미지

Supercomputing 2009 exhibition라는 행사에서 NYSE Tech가 아래와 같은 시스템을 시연하였다고 합니다.

The demonstration showcases Data Fabric, running side-by-side in RDMA and standard TCP modes. Using RDMA over the Voltaire Messaging Service (VMS) transport, the demonstration publishes one million, 100 Byte messages per second from a single 8-core Intel Xeon 5500 based server, to each of six subscribers on six more similar servers, for a total of six million messages streaming through the middleware per?second. Each server contains a NetEffect NE020 10 Gigabit Ethernet iWARP-capable server adapter from Intel. The test measures breakthrough, end-to-end, average one-second latency of 32 usec, with almost no jitter.

On a second set of unique servers, the demonstration publishes fifty thousand, 100 Byte messages per second to six other subscribers, using?the standard Linux Operating System TCP/IP transport. This generates a total of three hundred thousand messages per second streaming from the?publisher. Despite using the same 10Gigabit Ethernet network, the throughput is significantly lower while latency is an order of magnitude higher and more prone to latency jitter.
HPCwire:Voltaire,NYSE Technologies Deliver Messaging Solution중에서

5.
개인적인 생각으론 Software Acceleration기술이 한국시장에선 더 고객에 대한 접근성이 높을 듯 합니다. FPGA를 이용한 제품에 대해 IT부문에서 거부감이 있을 듯 합니다. Ethernet환경에서 RDMA를 구현하는 기술은 이미 윈도우 및 리눅스환경에선 오픈소스로 구현되어 있기때문에 AS-IS시스템에 큰 변화없이 적용할 수 있지 않을까 합니다.

알고리즘트레이딩에서 아주 중요한 부분이 (Ultra) Low Latency Market Data입니다. 2와 같은 방식으로 처리되는 Market Data로는 온전한 의미의 알고리즘트레이딩을 구현하기 힘듭니다. 더구나 HFT(High Frenquency Trading)은 더욱더 힘듭니다.

Leave a Comment

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.