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:
- What happens if I do not use ZTS? Can we safely use it on
production
servers which get multiple requests? - Is ZTS platform specific? We need to see if we "really" need this to
be enabled on NetWare. - Why is ZTS an option and not mandatory?
Your inputs on this is highly appreciated.
Thanks,
Ananth.
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.
AFAIK that's the acronym.
Correct me if I am wrong.
We have a couple of questions on this:
- What happens if I do not use ZTS? Can we safely use it on
production servers which get multiple requests?
As long as you don't have multiple threads you can do without ZTS. AFAIK
Netware has no concept of processes and only threads, so you will need
ZTS.
- Is ZTS platform specific? We need to see if we "really" need this to
be enabled on NetWare.
It doesn't really depend on the platform, but more on the SAPI. IIS uses
threads to process scripts, Apache 1.3 uses processes, CGI is always a
process, Apache 2 can do both threaded processing or the old Apache 1.3
method.
- Why is ZTS an option and not mandatory?
It's selected by the SAPI module you use, ZTS slows down performance (a
bit) and it buys nothing when a webserver is not processing requests in
threads like Apache 1.3
Derick
--
"my other box is your windows PC"
Derick Rethans http://derickrethans.nl/
PHP Magazine - PHP Magazine for Professionals http://php-mag.net/
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.
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:
- What happens if I do not use ZTS? Can we safely use it on
production
servers which get multiple requests?- Is ZTS platform specific? We need to see if we "really" need this to
be enabled on NetWare.- Why is ZTS an option and not mandatory?
Your inputs on this is highly appreciated.
Thanks,
Ananth.