Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '*not*': 0.07; 'context': 0.07; 'cc:addr:python-list': 0.11; 'thread': 0.14; '2-4': 0.16; 'advantage.': 0.16; 'blocking': 0.16; 'hardware.': 0.16; 'semantics': 0.16; 'subject:Thread': 0.16; 'surprising': 0.16; 'thread,': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'thu,': 0.19; 'memory': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'header :User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'push': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'generally': 0.29; 'evil': 0.31; 'talked': 0.31; 'core': 0.34; 'prepare': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; "didn't": 0.36; 'thanks': 0.36; 'two': 0.37; 'server': 0.38; 'most': 0.60; 'from:charset:utf-8': 0.61; 'content-disposition:inline': 0.62; 'life': 0.66; 'increase': 0.74; 'calls,': 0.84; 'cpu.': 0.84; 'received:86': 0.91; 'received:hu': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=8rqRkNcf7+UGhTeQwm8W7+bxOxky6zY6zJvigO2WSqI=; b=Rw0zg0DVhfY4K8unLPdu62uCSgwGD8imvb0z077iEXrkf+qrAHA1/Dsd3Wt8eAYSxO SAnay3vgeufAK/ZyJPM+dWZE0vNh13gfTlPUdHg6IjqQHJ6+txhuKmNZceItGkU9xNd2 IV/yIDOQX777tF55rdcEYj3eI1yuZaKB+kxldsbYGFCVOeyropGjjYG9G7A6Ezb91jqE OVOkUXrDYrL2sRluCWc90lbewR0i/aTtWd/XVHsM5a6WhF80vmtIaEmregPy2bnAkVHJ dVN5TnFEUbqUHbVeDZjZAdvTGZbQ1OqIQaL2GxgcDX6qU/bYUfFy0bcB7VOC1Q8QKRL2 mz0Q== X-Received: by 10.180.75.144 with SMTP id c16mr4554141wiw.9.1409217453378; Thu, 28 Aug 2014 02:17:33 -0700 (PDT) Date: Thu, 28 Aug 2014 11:19:06 +0200 From: Ervin =?utf-8?Q?Heged=C3=BCs?= To: Marko Rauhamaa Subject: Re: Thread terminate References: <20140827185514.GA18660@arxnet.hu> <87sikhf0m2.fsf@elektro.pacujo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87sikhf0m2.fsf@elektro.pacujo.net> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409217460 news.xs4all.nl 2928 [2001:888:2000:d::a6]:51303 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77194 Hi Marko, On Thu, Aug 28, 2014 at 12:02:29PM +0300, Marko Rauhamaa wrote: > Ervin Hegedüs : > > > at this time there is only one thread, as you wrote. I just try > > to prepare it to higher load, when one thread will not enough... > > Threads are a necessary evil when dealing with blocking function calls, > but evil they remain. I would generally *not* associate a thread for > each parallel context but work with a limited thread pool, whose size is > independent of the number of contexts. Often, a good rule of thumb is to > have two threads per CPU core to get most out of the hardware. thanks - I didn't plan to increase of size of thread pool to greather than 2-4 - the server has 4 CPU. > Since you talked about forking, you might be better served with a pool > of processes instead of threads since processes have less surprising > semantics and, if push came to shove, you can kill them with a signal. life with threads are better in my case - the shared memory is a big advantage. That's the only reason... :) Thanks, a.