Asynchronous logging versus Memory Mapped Files 12-01-2012 by saoj | 0 comments One of the challenges of HFT systems is to minimize I/O latency. Whenever you want to write something to the disk or send something to the network you risk introducing latency in your critical thread. One solution for this problem is NIO (non-blocking I/O). For disk I/O you can use a memory-mapped file and for network I/O you can use a non-blocking channel. NIO is supposed to provide asynchronous output (i.e writes), meaning you pass the bytes to the OS (i.e. copy them to a direct byte buffer) and hope that the OS will make the best effort to do its job. In this article I will investigate how really asynchronous a write to a memory-mapped file is and then I will show you how you can use a lock-free queue to make a writing operation as asynchronous as possible.