Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51025 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85779 invoked from network); 14 Dec 2010 18:06:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Dec 2010 18:06:05 -0000 Authentication-Results: pb1.pair.com header.from=israelekpo@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=israelekpo@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: israelekpo@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:41385] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/B4-59442-C02B70D4 for ; Tue, 14 Dec 2010 13:06:04 -0500 Received: by iym14 with SMTP id 14so451699iym.29 for ; Tue, 14 Dec 2010 10:06:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=1YrqRrHlk2HpaJ4dWKDVUPRPBix3tivk+mkcUihPFxw=; b=T9/dioNDf7fUEeunOt7MEGKQqYwFcb2tm+YRexurSQKA84uvbDqlK5x7NvuEH+YcFZ ZlrqzOQ4D8I1FcebZtJUTSsRld7vdbUwzP1Ju7Mn4k6QF9+gYs7ouK356FgMplxaPRyO 6PXeVHv/UARhcXIlrlxso2DGIJzYLf1sWiYOI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=D8h17U6Ak0/wZmL6Bi3vmrT9nV7BELRXudyRlkZhSULIRQPaU1x8uQ9b5vfJwqTTRU DDVprIOxRbiyugKUvmopiltOPyopX/qzHWLSxatyIk5FTDpbDpM8lVBUvanPWLn4gSab NN52CG7NVXTLpNNrPj9i9c7pxjsCWs6d5Rvp8= MIME-Version: 1.0 Received: by 10.231.39.76 with SMTP id f12mr3635600ibe.126.1292349961499; Tue, 14 Dec 2010 10:06:01 -0800 (PST) Received: by 10.231.12.137 with HTTP; Tue, 14 Dec 2010 10:06:01 -0800 (PST) Date: Tue, 14 Dec 2010 13:06:01 -0500 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=00032557335a6174d7049762ac7c Subject: PHP Performance in Apache: Multi-Process vs Multi-Threaded From: israelekpo@gmail.com (Israel Ekpo) --00032557335a6174d7049762ac7c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi All, I have a few questions about the performance of PHP web applications *under load* and I would appreciate if there is anyone that would like to share their experiences in terms of any benchmarks or observations. *Background Information* In multi-process environments, such as FastCGI, Apache Prefork MPM etc, PHP needs to execute the MINIT and MSHUTDOWN functions for all loaded extension= s on every request. In a multi-threaded environment, such as Apache Worker MPM, with Zend Threa= d Safety is enabled, PHP only needs to execute MINIT and MSHUTDOWN functions once for each extension and not each time a new thread is created to serve a request. It is also more expensive to create new processes than to create new threads. In one-on-one comparisons between scripts executed only once in ZTS mode an= d scripts executed once in non-ZTS mode, I noticed that the one in non-ZTS mode was slightly faster and this seems t= o be the main reason why most people go with the non-ZTS enabled setups. But the reason for this slight difference in speed is because of the differences in the data structure for globals for ZTS and non-ZTS modes. Other reasons people have cited for going with non-threaded setups include stability which I guess we should not really be concerned about if non-threadsafe extensions are excluded. Since it is generally more expensive to create new processes than new threads, I believe that under high load, php in ZTS mode (multi-threaded environment) will perform better than an identical setup in NTS mode (multi-process). *Problem* I noticed that Zend Server is using PHP in FastCGI mode (multi-process NTS) and I am contemplating setting up apache in worker mode (threaded mode) and compiling php in ZTS mode instead. Has anyone performed any load tests benchmarks comparing the two setups (Multi-Process vs Multi-Threaded)? Are there PHP extensions that cause issues in threaded environments that I should avoid? Are there any internals information or any other reasons why I should choos= e ZTS over NTS or vice versa? Any useful feedback will be highly appreciated. Thanks. --=20 =C2=B0O=C2=B0 "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once. http://www.israelekpo.com/ --00032557335a6174d7049762ac7c--