Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-server
Navigation:
Lists: gentoo-server: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-server@g.o
From: Vladimir Rusinov <vladimir.rusinov@...>
Subject: Re: apache2 threads
Date: Wed, 25 May 2011 18:04:03 +0400
<br><br><div class="gmail_quote">On Wed, May 25, 2011 at 4:18 PM, Stéphane Guedon <span dir="ltr">&lt;<a href="mailto:stephane@...">stephane@...</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Wednesday 25 May 2011 14:04:17 Vladimir Rusinov wrote:<br>
&gt; On Wed, May 25, 2011 at 3:34 PM, Stéphane Guedon<br>
&lt;<a href="mailto:stephane@..." class="vt-p">stephane@...</a>&gt;wrote:<br>
&gt; &gt; I read the apache2 doc, and I don&#39;t really know the principes of mpm.<br>
&gt; &gt; Worker,<br>
&gt; &gt; prefork... Don&#39;t understand really ! :(<br>
&gt;<br>
&gt; Ok, than in order to explain (or suggest books/articles) we need to know:<br>
&gt; Do you understand basic architecture concepts of multi-process network<br>
&gt; server?<br>
&gt; Do you understand what fork() is?<br>
<br>
</div></div>The only thing in this subject I have understood (I think, not sure... :) ) is<br>
that apache start few child processes and it&#39;s this processes that respond to<br>
requests.<br></blockquote><div> </div><div>Yep, this is correct.</div><div><br></div><div>Classic architecture of network server is a follows:</div><div>main process listens on network address, and when there is new client connection, it creates new child process (using fork() system call, which just duplicates process) or thread. Child process works with this new connection, while main continues to wait for next connection. So it is possible to process number of requests at the same time.</div>
<div>Apache (and many other web server) behaves and the same way, but it somewhat smarter: it maintains pool of processes, so there is no need to do fork() for each connection - fork might be quite expensive. This behavior called prefork, and it is being implemeted by prefork mpm, where mpm stands for &#39;multiprocessing module&#39;.</div>
<div><br></div><div>There are other mpms exists as well: &#39;worker&#39;, which is basically the same as perfork, but it operates with threads, not with processes.</div><div>Thread is lighter (it is &#39;lightweight process&#39;), it shares memory with other threads, it&#39;s faster to create and it have less overhead. But since all threads of the process have access to whole process memory, error in one thread could break other threads and cause whole process to die. This is usually not happens in stable environments, but it could happen for example with apache+mod_php+some exotic untested extension.</div>
<div><br></div><div>HTH</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Yes, I am not skilled, but said it earlier, and I think of myself quite<br>

courageous to get into Linux and Apache adventure without this knowledges...<br>
:)</blockquote></div><div><br></div>Good luck!<div>I could also suggest to read some articles/books about network programming. Good book is &#39;UNIX Network Programming&#39; by Richard Stevens, but it could be overkill.<br clear="all">
<br>-- <br>Vladimir Rusinov<br><a href="http://greenmice.info/">http://greenmice.info/</a><br>
</div>
References:
apache2 threads
-- Stéphane Guedon
Re: apache2 threads
-- Stéphane Guedon
Re: apache2 threads
-- Vladimir Rusinov
Re: apache2 threads
-- Stéphane Guedon
Navigation:
Lists: gentoo-server: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: apache2 threads
Next by thread:
Re: apache2 threads
Previous by date:
Re: apache2 threads
Next by date:
RE: Mailing List Manager that does not need to integrate tightly with the mail server?


Updated Jun 22, 2012

Summary: Archive of the gentoo-server mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.