Re: Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded
| From: | Julien Pauli | Date: | Wed, 15 Dec 2010 16:46:32 +0000 |
| Subject: | Re: Re: PHP Performance in Apache: Multi-Process vs Multi-Threaded | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51034@lists.php.net to get a copy of this message | ||
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 memory
top sees (and other tools such as 'free').
Anyway, even with a good kernel process COW, threaded systems tend to
be less memory hungry than equivalent forked systems.
APC uses shared segments with differents tools such as shm, mmap
etc... (chosen at compile time).
J.Pauli
On Wed, Dec 15, 2010 at 12:58 PM, Jon Davey <jond3k@gmail.com> wrote:
> 2010/12/15 Julien Pauli <jpauli@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 ~40/50Mb per process
>> which is very huge. Considerating 50 parallel processes eat up 2-3Gb
>> for example.
>>
>
> Surely creating a fork of a 50MB process will not consume an
> additional 50MB because of copy-on-write virtual memory? I would think
> you would only see this growth in memory usage if the extensions
> maintained a large payload of data that was being heavily modified in
> each request, such as caches, but I expect they create their own
> shared memory segments (I have yet to check the source of APC).
>
> Jon
>