From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_PASS,T_RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 75A1F20282 for ; Tue, 20 Jun 2017 19:08:57 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 2783812077C; Wed, 21 Jun 2017 04:08:55 +0900 (JST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by neon.ruby-lang.org (Postfix) with ESMTPS id F0866120759 for ; Wed, 21 Jun 2017 04:08:51 +0900 (JST) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 685CE20282; Tue, 20 Jun 2017 19:08:50 +0000 (UTC) Date: Tue, 20 Jun 2017 19:08:50 +0000 From: Eric Wong To: ruby-core@ruby-lang.org Message-ID: <20170620190850.GA11984@whir> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-ML-Name: ruby-core X-Mail-Count: 81732 Subject: [ruby-core:81732] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" 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)