Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65489 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65723 invoked from network); 30 Jan 2013 11:16:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2013 11:16:46 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain zend.com does not designate 209.85.214.173 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.214.173 mail-ob0-f173.google.com Received: from [209.85.214.173] ([209.85.214.173:36010] helo=mail-ob0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/9A-09318-D1109015 for ; Wed, 30 Jan 2013 06:16:46 -0500 Received: by mail-ob0-f173.google.com with SMTP id dn14so1498862obc.32 for ; Wed, 30 Jan 2013 03:16:43 -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=obAW9/QRa/jS4CePkw7DdcyaFqYkWDW9quQN+Q2tSTg=; b=FbT6rInwwfxAcXDWl+5vvfekhxAf2vbjlCg0+kfOW9KHgDRaM0IIX7DudGjLEl+2XF kSN3+WgW37YRV8V2ggrXf6Wc2bfNIV0YRCnY5/9M5//VxWicsl5tEI8m1safaXTEe4nm 55jw49NCJFKEZ2RiSa2TPxKLe5yD2B969XFhQmmjfTdt3KArS+MiE8aP8v/8WYfaGEgJ jHYpLEaE6dw3GPrEg2gwMOie3bbour7NvmLHxz4hpDi5ZH8eC8BYNUCeyyms1UNIoLCV CQ7h+3swQWnpJ7uspMHdVPJB31skUV2LIlsi9hGT7+G21hU/1pzvwRNppyH/2WZD2WCe lWMQ== X-Received: by 10.182.182.68 with SMTP id ec4mr3278185obc.26.1359544602834; Wed, 30 Jan 2013 03:16:42 -0800 (PST) References: <5108743A.9090705@sugarcrm.com> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJJdUzE2iPwKiwvzciYvchG03LAWgHrKhe1AkgXmvEAyNLsagGCs/1aAVyIuMoBzi4ZIgKDM2kDlwle5JA= Date: Wed, 30 Jan 2013 13:16:41 +0200 Message-ID: <4d977bab18152b2e86d968f4db9d12ef@mail.gmail.com> To: Pierre Joye , Stas Malyshev Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQkf29XFuAMIXsBO+4CssoXDj2+9KpMGYu+HXBfeW9U4N7aJbwxk4sPlAAqhx1qL7UO4C5uZgsM2MmFxnDpDbPD5xv1TPHa3gJakdOwwYz9hT9SqUgKPPS1pnZD1TADthl4iadJX 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: Wednesday, January 30, 2013 8:10 AM > To: Stas Malyshev > Cc: Zeev Suraski; PHP internals > Subject: Re: [PHP-DEV] ZTS - why are you using it? > > On Wed, Jan 30, 2013 at 2:15 AM, Stas Malyshev > wrote: > > Hi! > > > >> Python, for example, is thread safe by default. Extensions developers > > > > Doesn't Python have global engine lock? > > Right, but they do not give up thread safety. See "Thread State and the Global > Interpreter Lock" in: > > http://docs.python.org/2/c-api/init.html Pierre, As Stas pointed out a global lock has very little to do with the topic of discussion here. What PHP is trying to do is *much* more ambitious, so ambitious that at least I concluded it's not an achievable goal. This has nothing to do with laziness, much like deprecating safe_mode wasn't about laziness - it was about facing reality. The Python approach is exceptionally lazy (in software development that's often a Good Thing), and can be implemented very quickly if we wanted to. It wouldn't help you one bit with your use cases, though. > The TS model in php should be redesigned in the next major version, instead of > simply giving it up. I don't mind that we redesign TS for the next version, with two key issues: 1. I'm not sure that relying on TLS (beyond what we already do on TSRM today) is feasible. That was the na=C4=8Fve approach that I first tried ba= ck in 1999 and ended up ditching since it wasn't suitable. The two main ones are: [a] limited TLS space (we have *lots* of globals) [b] Inability to access globals from another image (e.g.., you won't be able to access sapi_globals which belong to php5.dll from mysqli.dll). Point [b] is mentioned in the RFC that you referred to. Point [a] might have been solved over the course of the last decade. TSRM wasn't designed for fun, it was there to solve real problems that TLS did not solve. 2. I think it's not very good use of our time. Based on what I heard in this thread, I would give up right here and now on the goal of having PHP run in-process in multithreaded web server. The pros pale in comparison to the cons. I would *not* remove ZTS - this was never the point of this thread - but I would recalibrate people's expectations about it. It sounds as if it could be useful for advanced 'I know what I'm doing' use cases like long-running threaded processes, and may be useful for the future if we ever want to support threads within a single request - but that's about it. Based on the feedback on this thread, I think we should instruct users that using thread-safe versions of PHP is slower, and that actually putting thread-safe PHP inside a multithreaded server is not a very reliable solution. We should recommend FastCGI/fpm instead. We should do that tomorrow morning (figuratively speaking). Zeev