Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51035 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54145 invoked from network); 15 Dec 2010 17:12:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Dec 2010 17:12:07 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:56340] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/70-49824-0E6F80D4 for ; Wed, 15 Dec 2010 12:12:01 -0500 Received: by yws5 with SMTP id 5so1247398yws.29 for ; Wed, 15 Dec 2010 09:11:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=MZ5UK6JgewXk9qb3rjP1b+jw9uuWHQ04k2Jtxqn/daY=; b=FEwtb9WE7b/7XhPHm/rRU1h3OMLK4u2KP4sMU6DZa4IP+MGG9Wvfmn5UJODZ5aENga sp+UWxcMhP/Ja2wBYJaNQdmEIbkcikf/BGkCUsatkSqjohQcmDvAia7ANqeTCgFjLFUy tpSMFMF0vb/2NGOrniktNPdLZnihlwNV018QI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=am+82TGfepnVSi7HNMD9ATPUqaHbF59q9drsEecfn2rlBh5A/v6LbvAnTf4+HhIEvN lxGmraRl+y+TcrSDaWfObNuUfUl8Blx6b12PHc+Yb1MFhrzMA0BMzFmeO9Ur+vH9Gqx5 sDsyy91b45V9AUE4QvrmQK5nsLZ6oKEu+NCwk= MIME-Version: 1.0 Received: by 10.90.248.28 with SMTP id v28mr8535136agh.168.1292433117485; Wed, 15 Dec 2010 09:11:57 -0800 (PST) Sender: tyra3l@gmail.com Received: by 10.90.53.4 with HTTP; Wed, 15 Dec 2010 09:11:56 -0800 (PST) In-Reply-To: References: Date: Wed, 15 Dec 2010 18:11:56 +0100 X-Google-Sender-Auth: 4wV6e1Bt6NGSYATs3-1_MHhgrRw Message-ID: To: Julien Pauli Cc: Jon Davey , jvlad , internals@lists.php.net Content-Type: multipart/alternative; boundary=0016363b8e5add1c7404977608b8 Subject: Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded From: info@tyrael.hu (Ferenc Kovacs) --0016363b8e5add1c7404977608b8 Content-Type: text/plain; charset=UTF-8 On Wed, Dec 15, 2010 at 5:46 PM, Julien Pauli wrote: > Well, I can't answer precisely about kernel fork() implementation and > possible copy on write mechanisms. May vary across systems. > Someone here could answer I suppose. > > 'top' on httpd process with a prefork mpm gives each child process > memory as a whole XxxMb process, but I don't know what kind of memory > top sees (and other tools such as 'free'). > Anyway, even with a good kernel process COW, threaded systems tend to > be less memory hungry than equivalent forked systems. > > APC uses shared segments with differents tools such as shm, mmap > etc... (chosen at compile time). > > J.Pauli > > http://www.kernel.org/doc/man-pages/online/pages/man2/fork.2.html Under Linux, *fork*() is implemented using copy-on-write pages, so the only penalty that it incurs is the time and memory required to duplicate the parent's page tables, and to create a unique task structure for the child. Imo if you create the threads or worker processes beforehand, there isn't much difference between the two method in performance POV. good slides on the fork vs threads: http://samba.org/~tridge/talks/threads.pdf so for me I would go with the prefork, because it's easier to maintain (non-thread safe apps are hard to debug :/) Tyrael --0016363b8e5add1c7404977608b8--