From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 118391BA007E for ; Tue, 9 May 2017 14:11:03 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id A4BB9B5D8BD for ; Tue, 9 May 2017 14:54:43 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 20EDF18CC80A for ; Tue, 9 May 2017 14:54:43 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id F2F9F120755; Tue, 9 May 2017 14:54:42 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from mail.atdot.net (ik1-326-23156.vs.sakura.ne.jp [153.126.180.160]) by neon.ruby-lang.org (Postfix) with ESMTP id D3CAF120718 for ; Tue, 9 May 2017 14:54:39 +0900 (JST) To: Ruby developers References: <20170403044254.GA16328@starla> <20170508003315.GA3789@starla> <38090d10-c6a1-5097-66af-130275d773ea@atdot.net> <2b47c736-08d8-095b-0454-2dd0b1020b03@atdot.net> <20170508030120.GB24763@starla> <94ca8f9a-7001-12d3-323d-8c5751569c51@atdot.net> <20170508063633.GA6821@starla> <4a83bbeb-b22b-61ec-a03f-657746843431@atdot.net> <20170509033806.GA27973@starla> <20170509051223.GA31857@whir> From: SASADA Koichi X-Enigmail-Draft-Status: N1110 Message-ID: Date: Tue, 9 May 2017 14:54:37 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170509051223.GA31857@whir> X-ML-Name: ruby-core X-Mail-Count: 81050 Subject: [ruby-core:81050] Re: [ruby-cvs:65407] normal:r58236 (trunk): thread.c: comments on M:N threading [ci skip] 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" On 2017/05/09 14:12, Eric Wong wrote: > SASADA Koichi wrote: >> On 2017/05/09 12:38, Eric Wong wrote: >>> 100 epoll FDs is a waste of FDs; especially since it is common >>> to have a 1024 FD limit. I already feel bad about timer thread >>> taking up two FDs; but maybe epoll/kevent can cut reduce that. >> 1024 soft limit and 4096 hard limit is an issue. However, if we employ >> >>> I can easily imagine Ruby doing 100 native threads in one process >>> (8 cores, 10-20 rotational disks, 2 SSD), but 20000-30000 fibers. >> 20000-30000 fibers, it is also problem if they have corresponding fds. >> So that I think people increase this limit upto 65K, don't? > Yes, for people that run 20000-30000 fibers maybe it is not a > problem to have 100 epoll FD... > > However, for existing apps like puma, webrick and net/http-based > scripts: they can spawn dozens/hundreds of threads and only use > one socket per thread. It is a waste to use epoll/kqueue to > watch a few number of FD per thread (ppoll is more appropriate > for watching a single FD). I see. 1000 fds -> 500 fds (with per-thread epoll) is bad. > On the contrary; software like nginx and cmogstored watch > thousands of FDs with a single epoll|kqueue FD. > >>> In the kernel, every "struct eventpoll" + "struct file" in >>> Linux is at least 400 bytes of unswappable kernel memory. >> 400B * 100 = 40KB. Is it problem? I have no knowledge to evaluate this >> size (10 pages seems not so small, I guess). > I'd rather not use that much memory and save whereever possible. On the other hand, aggressive I/O request can conflict by multi-thread app. But current ruby threads don't run in parallel, so that it seems no problem (hopefully). It seems can cause problem on parallel running Guilds (but not available now). -- // SASADA Koichi at atdot dot net