Re: To understand ZTS in PHP.
| From: | Wez Furlong | Date: | Fri, 02 May 2003 11:13:08 +0000 |
| Subject: | Re: To understand ZTS in PHP. | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1161@lists.php.net to get a copy of this message | ||
The PHP/ZE architecture has a very strong thread-affinity; all "global"
variables in an instance of the engine are stored in
thread-local-storage so that they are:
a) safe from modification by other instances of the engine running on
different threads (in the same process)
b) Reasonably fast to fetch in callbacks made by third-party libraries.
You *need* a ZTS build of PHP when the SAPI that is running PHP is
multithreaded; eg: when more than one thread is running concurrently.
ZTS is not mandatory because passing around the TSRMLS introduces
overhead in terms of additional stack usage and some CPU time. Also,
TSRMLS_FETCH() (which plucks the engine globals out of the TLS), is
quite expensive, even though it is tuned for speed.
Based on what you have mentioned in the past about Netware (that it
doesn't have processes, only threads), it sounds like ZTS should be used
on that platform. However, you're the netware expert, not me :)
The decision to use ZTS is usually made by configure based on the SAPI
you are compiling for; eg: Apache 1.3.x does not require ZTS (at least
on regular UNIX platforms), nor does CGI, whereas threaded servers,
such as ISAPI and NSAPI do require it.
--Wez.
On Fri, 2 May 2003, Ananth Kesari wrote:
> Hi,
>
> We are developing PHP for NetWare. We have a question here. This could
> be a trivia, but still asking to understand more.
>
> In the TSRM module, and other places also, the code contains ZTS (I
> guess ZTS stands for Zend Thread Safety. Am I correct?). From what I
> understand this is for providing safety to the threads using mutexes.
> Correct me if I am wrong.
>
> We have a couple of questions on this:
> 1. What happens if I do not use ZTS? Can we safely use it on
> production
> servers which get multiple requests?
> 2. Is ZTS platform specific? We need to see if we "really" need this to
> be enabled on NetWare.
> 3. Why is ZTS an option and not mandatory?
>
> Your inputs on this is highly appreciated.
>
> Thanks,
> Ananth.
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>