Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I’ve moved away from mmap for trading in favor of a separate write thread.

While mmap is fast, the combination of factors that can make it decide to stall your thread while it commits to disk is difficult to manage from an operational standpoint. A slight misconfiguration is all it takes to introduce a rare and hard to notice multi-millisecond delay.

Whereas with a spinlocked sized-reserved vector, the fail state performance is however long it takes to allocate more space which is on the level of microseconds. You do pay 50-150ns for that spinlock though.



Or better yet, mmap in a read-write-thread?


Ya sure, go nuts on the other thread. It’s not critical to trading. I normally fprintf all sorts of time stamps, log level info, and handle formatting over there.

Just make sure you put it on another core to protect your cache.

But if you want mmap, you do you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: