Back to the Future with C++ and Seastar
Nadav Har'El
nyh at math.technion.ac.il
Wed Apr 1 21:53:44 IDT 2015
On Wed, Apr 01, 2015, Oleg Goldshmidt wrote about "Re: Back to the Future with C++ and Seastar":
> "Nadav Har'El" <nyh at math.technion.ac.il> writes:
> > Seastar is an open source (http://www.seastar-project.org/) library.
> > It is based on the concept of "futures" (like in Node.js, just implemented
> > in a much more efficient way). Part of the talk will also introduce futures,
> > how Seastar implements them in C++, and how much C++ has changed in recent
> > years from what you may remember about it.
>
> I might come (close to work :). C++ has futures and promises natively,
> as a part of its standard library. Can you add a couple of words on how
> Seastar's futures differ?
Sure, though I'm sure Avi will explain it better in his talk :-)
The first difference is that C++11's support for futures is incomplete:
Futures are supported, but not *continuations*, which are code you want
to run when the future value becomes available. C++17 will probably have
continuations, but Seastar has them now.
The second difference is that C++11's futures are indeed powerful, but not
optimized for performance. They make excessive use of allocations, they
rely on threads and everything uses atomic operations and locks. Seastar's
design, on the other hand, is aimed at modern SMP design, for achieving
the top possible performance: Continuations are very lightweight (not
based on thread context switching), you write with Seastar a share-nothing
server (each core deals with its own data) so no locks, no atomic operations,
and very little cache contention. These things make a *huge* difference
in performance in modern SMPs - especially when you try to scale up to
many cores.
The third difference is that Seastar is much more than just an
implementation of futures - it is a complete library for writing
asynchronous I/O-heavy (network and disk) applications - consider http
servers, proxies, nosql servers - any server application you can think of
will be much faster if rewritten in Seastar (Avi will present some
benchmarks, showing near perfect scalability to 40 cores, 5x speed
improvements compared to traditional thought-to-be-efficient applications,
etc. Seastar completely bypasses the operating system by using DPDK,
but as you may know DPDK only supports L2 packets and has no TCP/IP stack.
But that's no longer true: We actually implemented in Seastar a full
TCP/IP stack over DPDK, write in Seastar's own futures framework.
And Seastar is even more. I'll leave a few surprises for Avi's talk ;-)
--
Nadav Har'El | Wednesday, Apr 1 2015, 13 Nisan 5775
nyh at math.technion.ac.il |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |My opinions may have changed, but not the
http://nadav.harel.org.il |fact that I am right.
More information about the Linux-il
mailing list