Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-16 Thread jvlad
No. Php if we talk about php with all its extensions is not threadsafe at all. Many of the extensions allocate static data and inherently non-thread-safe. PHP is, if compiled with ZTS/TSRM, thread-safe. Some libraries used by some extensions might not be thread safe, but basically all

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-16 Thread Scott MacVicar
On Dec 16, 2010, at 12:28 AM, jvlad wrote: No. Php if we talk about php with all its extensions is not threadsafe at all. Many of the extensions allocate static data and inherently non-thread-safe. PHP is, if compiled with ZTS/TSRM, thread-safe. Some libraries used by some extensions

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-16 Thread Stas Malyshev
Hi! An example of non-thread safe is gettext it relies on the locale which is per process and not per-thread. PHP itself at the core is thread safe. As Johannes said most common modules are too. ICU btw has some global stuff too. It's actually worse as it has one global which is set

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-16 Thread jvlad
Scott MacVicar wrote in message: Do you think any locking function is implemented in openssl php extension? In PHP a SSL_CTX is per thread and is not shared across other threads so it isn't an issue. We don't need to implement any openssl locking functions. It does not matter

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-16 Thread Stas Malyshev
Hi! ICU btw has some global stuff too. I think it's clear that having any global stuff does not necessarily make the code thread-unsafe. Oh, this one does. It's not crash-unsafe, just weird-bugs-unsafe. It's my only guess - this is because a correct sorting of words in some languages

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-15 Thread Julien Pauli
Well, I would say that if your problem is memory, you should consider threads as they all share the same memory space in their process. Apache's children can weight very heavy if PHP's been compiled to support lots of extensions, you can happen with ~40/50Mb per process which is very huge.

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-15 Thread Johannes Schlüter
On Tue, 2010-12-14 at 22:22 +0300, jvlad wrote: No. Php if we talk about php with all its extensions is not threadsafe at all. Many of the extensions allocate static data and inherently non-thread-safe. PHP is, if compiled with ZTS/TSRM, thread-safe. Some libraries used by some

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-15 Thread Jon Davey
2010/12/15 Julien Pauli jpa...@php.net Well, I would say that if your problem is memory, you should consider threads as they all share the same memory space in their process. Apache's children can weight very heavy if PHP's been compiled to support lots of extensions, you can happen with

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-15 Thread Julien Pauli
Well, I can't answer precisely about kernel fork() implementation and possible copy on write mechanisms. May vary across systems. Someone here could answer I suppose. 'top' on httpd process with a prefork mpm gives each child process memory as a whole XxxMb process, but I don't know what kind of

Re: [PHP-DEV] Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded

2010-12-15 Thread Ferenc Kovacs
On Wed, Dec 15, 2010 at 5:46 PM, Julien Pauli jpa...@php.net wrote: Well, I can't answer precisely about kernel fork() implementation and possible copy on write mechanisms. May vary across systems. Someone here could answer I suppose. 'top' on httpd process with a prefork mpm gives each