Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65393 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73384 invoked from network); 29 Jan 2013 14:14:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2013 14:14:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain zend.com does not designate 209.85.214.182 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.214.182 mail-ob0-f182.google.com Received: from [209.85.214.182] ([209.85.214.182:38717] helo=mail-ob0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/7D-10721-839D7015 for ; Tue, 29 Jan 2013 09:14:17 -0500 Received: by mail-ob0-f182.google.com with SMTP id va7so433850obc.41 for ; Tue, 29 Jan 2013 06:14:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:references:in-reply-to:mime-version:x-mailer :thread-index:date:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=7ifLJA7mA45bC5OeARaaOY7EPBhYImdTlpLXNuPh7KE=; b=o0muw7Gv17XLQEjBDiVR7xorWPStl8RNK+l3yMBM5V9naMUiO+/ATlRMmDDgygrYpa rnddTtOsQ/Npd595ByU+GMzfA+M2PkWatGcgxkXLsJMBj9rJ0tP2weYvKMCEKQN5efkC 6CMEVrX8ONuJ+L8GfwknC7V6LEffDSW6RQBkuW8tBMGAggRXfAV7qS1sNeCRlsafpm9P eYwfZKLSfnlNc0WonSp3b4hTjHhNXE+/w28axfUJBoWqp3pBk9ZiBF+bpVf/PbNI0p0d vSdSq7L6M7zVa+BxhSZDv140ClIVLxf96Ft4ATidu0FAveU5zGKrVmlNCeJhKHpEECXf 5+dQ== X-Received: by 10.182.182.68 with SMTP id ec4mr827672obc.26.1359468854239; Tue, 29 Jan 2013 06:14:14 -0800 (PST) References: <1359459921.3916.105.camel@guybrush> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJJdUzE2iPwKiwvzciYvchG03LAWgHrKhe1AkgXmvEAyNLsagInIOvjAjNe6uACi4oZMwH0VTMxAfvbstQBoGVPgZbd0fvA Date: Tue, 29 Jan 2013 16:14:13 +0200 Message-ID: <8d28541da15bbea04048c41051fe0f09@mail.gmail.com> To: Pierre Joye Cc: =?UTF-8?Q?Johannes_Schl=C3=BCter?= , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnEZJVDSXrl3NH4hPGUTsVedcSpO3KUSY4EJ9RquEJKd6LCSjVslOHuzCEAIxsjaRi8V2tuz1iDkvnJJG8pvM0+5CiSLDUUh0NX0FwFhcU1Ru7OE6EPxPhSX0f5wu/porN/0AIE Subject: RE: [PHP-DEV] ZTS - why are you using it? From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Pierre Joye [mailto:pierre.php@gmail.com] > Sent: Tuesday, January 29, 2013 3:19 PM > To: Zeev Suraski > Cc: Johannes Schl=C3=BCter; PHP internals > Subject: Re: [PHP-DEV] ZTS - why are you using it? > > On Tue, Jan 29, 2013 at 1:52 PM, Zeev Suraski wrote: > >> -----Original Message----- > >> From: Pierre Joye [mailto:pierre.php@gmail.com] > >> Sent: Tuesday, January 29, 2013 2:19 PM > >> To: Zeev Suraski > >> Cc: Johannes Schl=C3=BCter; PHP internals > >> Subject: Re: [PHP-DEV] ZTS - why are you using it? > >> > >> On Tue, Jan 29, 2013 at 1:06 PM, Zeev Suraski wrote: > >> > >> >> It is inter process sharing and is very expensive, nothing to > >> >> compare > >> > with shared > >> >> memory within a single process, accross many threads. > >> > > >> > What are you basing that assertion on? Shared memory should have > >> > identical performance to regular process memory. It's mapped in > >> > very similar way. > >> > >> Testing maybe? > > > > Retest then, you've got it wrong. Shared memory (or memory mapped > > files as they'd be on Windows) are simply memory, it's available to > > the process in exactly the same way and while the OS does slightly > > different book-keeping for it in how it populates the pages - it's negligible. > > It is not negligible, also the locking is different. Also, if I remember correctly > there is no rwlock support either, which is a huge cons. It is too negligible. Once the pages get allocated and mapped properly - it's exactly the same thing as accessing memory. Locking in between processes is indeed slower than locking inside processes, but at the risk of sounding like a broken record, in something like an opcode cache (few writes, mostly reads), it's negligible. > > For example, you could say that thread-safe PHP would be 2x faster. > > Or 2x more memory efficient. Or will enable us to do XYZ which we > > otherwise can't. > > There are quite a few things I can do on Windows only in thread safe > environments (f.e. ESENT, builtin DB, used by AD for example, damned fast). OK, now we're getting somewhere. So ESENT is one legit use case that would benefit from a multithreaded PHP. > > For now, an *utopian* ZTS mode would, at best, not give us anything. > > Even if we put aside the performance/reliability issues - why would > > someone want that mode over other modes? > > I must be really unclear or something along this line. Alone on IIS, there are > dozen of features you can't do nor use using fastcgi. Apache could also be used > in a better way (windows here too, linux has a module for both builds of > apache). Which ones? > btw, have you tried to compare IIS/FastCGI (I won't even try with > apache+fastcgi) on Windows vs nginx-fpm on linux? I would be very > surprised if your numbers show that they are equivalent. Not recently. But I'd be surprised if it wasn't equivalent at least as far PHP is concerned. Nginx is marginally faster in pure PHP performance than Apache; Where it really shines is that it can do it with fewer processes -> much less memory consumption. That attribute stems from breaking the 1:1 mapping and turning it into an n:m mapping. > It could have been the wrong path for some situation back then, but it is > definitively not wrong to improve thread safety. I didn't suggest that. My original question was 'Why do you use thread-safe ZTS'. It was explicitly not an RFC to stop developing or remove ZTS mode. I do think that we'll do our users a much better service if we tell them that unless they have a very good reason to use a web server plugin on a multithreaded server, they should use FastCGI instead. > > BTW, for the love of [insert here], I'm not talking about killing > > thread safety. > > That's how it looks and that's where this discussion is going, tbh. Well, it wasn't my intention, at all. I was genuinely surprised there was a high level of interest about ZTS when we discussed Optimizer+, which made me wonder why that is the case. > > It's useful for long running processes, and who knows, maybe in the > > future we'll have threads inside PHP. But I *am* talking about > > telling people that using ZTS in production is not recommended and > > that they should be using FastCGI instead. > > As far as I remember, we already do that for a couple of web servers. > And in the long run, I will rather tell not to use FastCGI for dedicated hosting and > the likes. That being said, I also met many ISPs which are not happy with the all- > fastcgi, memory usageand performance were the issues (have to read my > backlog for other details :). I think that properly configured FastCGI will be superior to a server-plugin in mostly every way. The one downside is that you lose the server-specific features, but that's typically not a huge price to pay. Zeev