[libevfibers] Re: libevfibers

  • From: Konstantin Olkhovskiy <lupus@xxxxxxxxxx>
  • To: Maxime Austruy <austruym@xxxxxxxxx>
  • Date: Mon, 4 May 2015 21:44:36 +0300

[ CCing mailing list ]

Hey Maxime,

2015-05-04 21:08 GMT+03:00 Maxime Austruy <austruym@xxxxxxxxx>:

The program I'm working on will need to have lots of fibers and I want to
take advantage of the several threads of execution that are possible on
modern CPUs. Looking at the code, it seems that if CORO_ASM is #defined
(likely in my case), the entire code base will still be single-threaded so
there will be no parallelism. Is that correct?


That is correct for any libcoro backend, the pthreads one just emulates
coroutines when anything else is not available.

Assuming it is, is there a recommended way to introduce parallelism when
using libevfibers?


Well, it greatly depends on what you are trying to do. If you have some
blocking tasks
to do, look at fbr_eio_custom(). If you want to scale horizontally with the
number of CPUs,
you can either run several fbr_context instances in separate threads (along
with separate libev
loops), or you can use multiple single-threaded processes, each having a
separate hard drive,
CPU and a separate networking interface, with some additional load balancer
in front of it.

--
Regards,
Konstantin

Other related posts:

  • » [libevfibers] Re: libevfibers - Konstantin Olkhovskiy