CppCon 2017: Carl Cook “When a Microsecond Is an Eternity: High Performance Trading Systems in C++”

preview_player
Показать описание


Automated trading involves submitting electronic orders rapidly when opportunities arise. But it’s harder than it seems: either your system is the fastest and you make the trade, or you get nothing.

This is a considerable challenge for any C++ developer - the critical path is only a fraction of the total codebase, it is invoked infrequently and unpredictably, yet must execute quickly and without delay. Unfortunately we can’t rely on the help of compilers, operating systems and standard hardware, as they typically aim for maximum throughput and fairness across all processes.

This talk describes how successful low latency trading systems can be developed in C++, demonstrating common coding techniques used to reduce execution times. While automated trading is used as the motivation for this talk, the topics discussed are equally valid to other domains such as game development and soft real-time processing.

Carl Cook: Optiver, Software Engineer

Carl has a Ph.D. from the University of Canterbury, New Zealand, graduating in 2006. He currently works for Optiver, a global electronic market maker, where he is tasked with adding new trading features into the execution stack while continually reducing latencies. Carl is also an active member of SG14, making sure that requirements from the automated trading industry are represented. He is currently assisting with several proposals, including non-allocating standard functions, fast containers, and CPU affinity/cache control.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

I've learned an immense amount from CppCon's uploads, this video included. Great talk, Mr. Cook.

justinkendall
Автор

Eye-opening talk. That trick with replacing if's with templates was simple and neat.

AdityaKashi
Автор

"I did a runthrough this morning, threw away about half the slides."

I felt that one. There's always too much to say and not enough time to say it.

tissuepaper
Автор

One of those jobs where finding a trick like this makes the company your salary back in earnings

narnbrez
Автор

Been looking for a talk like this for 10 years. Thanks!

Moriadin
Автор

Great talk, easy enough to understand. Thank you for taking the time.

grostig
Автор

As a person from the other end (Exchange), I find the differences quite interesting. We target to have an end to end latency of around 30us with a very low amount of jitter since we also care a little about throughput and use a fault tolerable distributed system. We often make performance sacrifices to keep the code base easy to understand for most people.

HashanGayasri
Автор

This was fascinating, gave me a lot to think about.

betajester
Автор

This is a great talk. Very different from the others, but still interesting, easily approachable, valuable info.

ciCCapROSTi
Автор

The entire presentation is about why you need to learn assembly, machine language and your hardware inside out when going for the fastest execution possible. Mid and high-level languages don't have any of the tools you need. You need to create them specifically for each platform if you want to exploit every single cycle to your advantage. If you change something / upgrade the hardware, then you're 100% going to need to rewrite part of the code or all of it to make it optimized again.
Mid-level languages are still insanely fast though, no question about that. The question is rather whether you can afford to place 2nd when you aimed to be 1st.

sirantoweif
Автор

Not sure you're supposed to mention the star gate. Mr SG14. Not SG1, I get it. You just want some recognition for your hard work.

Hector-bjls
Автор

This is a great talk, good content and well presented

memoriasIT
Автор

really want to know more about the measurement setup, how do you actually tap the line, how to actually do the configurations?

kenjichanhkg
Автор

Very good talk. Thanks for sharing, Carl.

GustavoPantuza
Автор

thanks for the eye-opening talk. If you turn off all other CPU cores, where does your OS kernel run on? would there be interference from OS if your thread and OS share the single core?

zhengchunliu
Автор

Hey Carl, great talk.

During the talk you mention having to delete a whole lot of slides; I wonder whether it is possible for you to share those slides as well? I think folks will be interested in those as well.

tonvandenheuvel
Автор

Why fight with your operating system when your program can be operating system itself thanks to solutions like includeOS?

LordNezghul
Автор

How does the flat unordered map not have cache misses? I thought it'd be a cache miss whenever the data has to be dereferenced from a pointer? Is the idea to allocate the data such that the data follows the map in memory so that the l2 and l3 caches hold it?

oblivion_
Автор

Yes map<> is slower then unordered_map<> since map it trying to sort as well. I found this out when dealing with millions of records.

mworld
Автор

14:38 "HandleError(errorFlags);" should only tell another thread to handle the error. The current thread should only perform the hot-path and non of the actual error handling. This way, the current thread's cache is hot-path-optimized. So we now have a hot-path-thread. Your thoughts?

dosomething