From: Eric Wong Date: 2017-06-20T19:08:50+00:00 Subject: [ruby-core:81732] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid samuel@oriontransfer.org wrote: > I appreciate what you said about multi-thread multi-fiber > execution using your proposed reactor design. I think it's > good and it's probably better than libev. It's excellent that > you have thought about how to solve these problems and I > admire it. However, in my experience, libev is fast enough and > n-m concurrency model is fast enough for Ruby. Until Ruby is > several orders of magnitude faster, it won't make much > difference, except perhaps a tiny bit of latency, but there > are benefits to keeping a single request on a single thread or > process - you can avoid having to deal with locking and other > synchronisation primitives in some cases, e.g. caches. So, > there are tangible benefits to using, say, m-process n-fibers > vs n-fibers/m-threads model. Ruby has never really suited > multi-threaded model unfortunately. Just one correction; auto-Fiber does not migrate fibers or migrate userspace(*) I/O operations across native threads at the moment. You might be confusing this with my other non-Fiber-using server designs which do migrate I/O operations across threads. For auto-fiber, there's minimal locking requirements even if we get rid of GVL. It relies on locking already done by the kernel; kqueue will require extra locking in the corner case where read and write filters are both installed for an FD. (*) Of course, Linux kernel soft IRQ handlers can migrate work across cores in the background. > Just to be clear: I'm more interested in semantics than > implementation. Get the semantics right and the correct > implementation will follow. I see a lot of work done here on > an implementation (which is awesome and it looks good), but > I'm not completely clear that the semantics are really sound. Anyways, it looks like matz is inclined to accept it; but ko1 wants some semantic tweaks with the API (but I'm not sure what/how, exactly). https://docs.google.com/document/d/1z19pKt8jlpiEUR3RnWWBCfs3OR_hbiAZMwpQ6ZTllP0/pub (I've only viewed it with w3m, no idea if I'm missing anything due to lack of JS) Unsubscribe: