Search code examples
ipcmmapquickfixfix-protocolmemory-mapping

memory mapping files for high frequency trading?


I am working in a high frequency trading client for stocks in C++. I am using the quickfix/J library to receive information from my broker. I need these two processes to communicate (one written in Java and the other in C++) and the latency has to be minimized as much as possible.

At first I thought about using FIFO named pipes, but I was reading about memory mapping and how the performance increases by mapping files into memory. My question is... Is it really that much faster? And what's the best way to accomplish this? Should I map a regular text file? Wouldn't using a regular text file be slow even with memory mapping?

Thanks in advance.


Solution

  • Memory mapping is really fast and it gives you an area that bot processes can access.

    The problem that arises is: How do the processes know that data has changed? You could add a kind of version number that increases as data changes, but with all additional locking across processes (semaphores), I do not believe that data transfer will be that much faster.

    So I think, for data transfer the overall performance compared with named pipes or queues will not be that much.