Re: Compiling PHP4
| From: | Rasmus Lerdorf | Date: | Tue, 30 May 2000 15:59:26 +0000 |
| Subject: | Re: Compiling PHP4 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-647@lists.php.net to get a copy of this message | ||
> Yes, that's true, but executable has to be loaded into memory to run. On top of
> that, apache runs multiple instances, so if you have 1.6 megs executable, you have
> a good portion of that loaded up in each thread, you have about 10 thread in idle
> time, and lets say 100 threads in a very busy time. So 200 x 1 meg = 200 megs, now
> it becomes a little more obvious why you would want to keep your size to a
> minimum. I don't know if 200 people all at once will ever come all at once, but
> still.
But, every modern OS supports shared pages. The fact that your httpd
executable is 1.6 Megs in size is meaningless. Running 200 instances of
that process does not mean you are using 200 * 1.6M of memory.
Here is an example from my laptop:
PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND
587 root 0 0 696 656 576 S 0 0.0 0.3 0:00 httpd
593 nobody 0 0 1980 1976 1256 S 0 0.0 1.0 0:00 httpd
594 nobody 1 0 2232 2228 1540 S 0 0.0 1.1 0:00 httpd
595 nobody 0 0 2232 2228 1540 S 0 0.0 1.1 0:00 httpd
The root-owned httpd doesn't serve up any pages, so its memory usage is
limited. The others that do eat up a bit. The RSS column lists the
amount of resident (ie. non-swapped) memory taken up by a process. This
number includes shared pages. The SHARE column tells you how much of the
memory is shared amongst other processes. So, in this case you can see
that the two large ones use 2.2M of memory each, however 1.5M of that is
shared. So, 2228-1540=687 which means that the additional memory usage
for each additional httpd is 687K and not 2.2M. The size of the actual
binary is pretty much irrelevant to these numbers.
-Rasmus