|
Posted by Mladen Gogala on 08/22/05 04:17
On Sun, 21 Aug 2005 23:29:10 +0000, one2001boy@yahoo.com wrote:
>
> the performance will be better with static link. shared module is not so
> good in performance.
This is the first time I hear a thing like that. There is a bit of an
overhead when apache starts up, as each of the httpd processes has to
load module by invoking dlopen and then resolving each symbol by
performing dlsym, but after that all the functions are defined and
addressable, just as if they were loaded in the same code segment.
$APACHE_HOME/modules/libphp5.so is loaded in a separate segment which
is mapped into the httpd process address space. You might have a choice
of how to link PHP5 but you don't have that choice when it comes to many
other shared libraries. Here is what the address of space of apache httpd
process looks like on FC3:
# ps -fp 5233
UID PID PPID C STIME TTY TIME CMD
nobody 5233 5221 0 20:52 ? 00:00:00 /opt/apache/bin/httpd -k start
#
# cat /proc/5233/maps
00111000-001dd000 r-xp 00000000 03:06 147553 /lib/tls/i686/libdb-4.2.so
001dd000-001df000 rwxp 000cc000 03:06 147553 /lib/tls/i686/libdb-4.2.so
001df000-001fb000 r-xp 00000000 03:07 139265 /opt/apache/lib/libapr-0.so.0.9.6
001fb000-001fc000 rwxp 0001c000 03:07 139265 /opt/apache/lib/libapr-0.so.0.9.6
001fc000-001fd000 rwxp 001fc000 00:00 0
001fd000-0021e000 r-xp 00000000 03:06 147477 /lib/tls/libm-2.3.5.so
0021e000-0021f000 r-xp 00020000 03:06 147477 /lib/tls/libm-2.3.5.so
0021f000-00220000 rwxp 00021000 03:06 147477 /lib/tls/libm-2.3.5.so
00220000-00229000 r-xp 00000000 03:06 147504 /lib/libnss_files-2.3.5.so
00229000-0022a000 r-xp 00008000 03:06 147504 /lib/libnss_files-2.3.5.so
0022a000-0022b000 rwxp 00009000 03:06 147504 /lib/libnss_files-2.3.5.so
0022e000-0022f000 r-xp 0022e000 00:00 0
0022f000-00240000 r-xp 00000000 03:05 691291 /usr/lib/libz.so.1.2.2.2
00240000-00241000 rwxp 00010000 03:05 691291 /usr/lib/libz.so.1.2.2.2
00241000-0025e000 r-xp 00000000 03:05 694358 /usr/lib/libjpeg.so.62.0.0
0025e000-0025f000 rwxp 0001c000 03:05 694358 /usr/lib/libjpeg.so.62.0.0
0025f000-0026e000 r-xp 00000000 03:06 147491 /lib/libresolv-2.3.5.so
0026e000-0026f000 --xp 0000f000 03:06 147491 /lib/libresolv-2.3.5.so
0026f000-00270000 r-xp 0000f000 03:06 147491 /lib/libresolv-2.3.5.so
00270000-00271000 rwxp 00010000 03:06 147491 /lib/libresolv-2.3.5.so
00271000-00273000 rwxp 00271000 00:00 0
003ca000-003e6000 r-xp 00000000 16:05 331264 /oracle/product/10g/lib/libexpat.so.0
003e6000-003e8000 rwxp 0001b000 16:05 331264 /oracle/product/10g/lib/libexpat.so.0
00547000-00557000 r-xp 00000000 03:05 690798 /usr/lib/libbz2.so.1.0.2
00557000-00558000 rwxp 00010000 03:05 690798 /usr/lib/libbz2.so.1.0.2
005cb000-005d3000 r-xp 00000000 03:06 147586 /lib/tls/librt-2.3.5.so
005d3000-005d4000 r-xp 00007000 03:06 147586 /lib/tls/librt-2.3.5.so
005d4000-005d5000 rwxp 00008000 03:06 147586 /lib/tls/librt-2.3.5.so
005d5000-005df000 rwxp 005d5000 00:00 0
005ee000-00603000 r-xp 00000000 03:06 147464 /lib/ld-2.3.5.so
00604000-00605000 r-xp 00015000 03:06 147464 /lib/ld-2.3.5.so
00605000-00606000 rwxp 00016000 03:06 147464 /lib/ld-2.3.5.so
00608000-0060d000 r-xp 00000000 03:05 691121 /usr/lib/libgdbm.so.2.0.0
0060d000-0060e000 rwxp 00005000 03:05 691121 /usr/lib/libgdbm.so.2.0.0
0062d000-0062f000 r-xp 00000000 03:06 147479 /lib/libdl-2.3.5.so
0062f000-00630000 r-xp 00001000 03:06 147479 /lib/libdl-2.3.5.so
00630000-00631000 rwxp 00002000 03:06 147479 /lib/libdl-2.3.5.so
00723000-00846000 r-xp 00000000 03:06 147468 /lib/tls/libc-2.3.5.so
00846000-00847000 --xp 00123000 03:06 147468 /lib/tls/libc-2.3.5.so
00847000-00849000 r-xp 00123000 03:06 147468 /lib/tls/libc-2.3.5.so
00849000-0084b000 rwxp 00125000 03:06 147468 /lib/tls/libc-2.3.5.so
0084b000-0084d000 rwxp 0084b000 00:00 0
0084f000-0085d000 r-xp 00000000 03:06 147481 /lib/tls/libpthread-2.3.5.so
0085d000-0085e000 r-xp 0000d000 03:06 147481 /lib/tls/libpthread-2.3.5.so
0085e000-0085f000 rwxp 0000e000 03:06 147481 /lib/tls/libpthread-2.3.5.so
0085f000-00861000 rwxp 0085f000 00:00 0
00887000-008e7000 r-xp 00000000 03:05 690892 /usr/lib/libfreetype.so.6.3.7
008e7000-008ee000 rwxp 00060000 03:05 690892 /usr/lib/libfreetype.so.6.3.7
00989000-0098e000 r-xp 00000000 03:06 147494 /lib/libcrypt-2.3.5.so
0098e000-0098f000 r-xp 00004000 03:06 147494 /lib/libcrypt-2.3.5.so
0098f000-00990000 rwxp 00005000 03:06 147494 /lib/libcrypt-2.3.5.so
00990000-009b7000 rwxp 00990000 00:00 0
009b7000-00b9b000 r-xp 00000000 03:07 139403 /opt/apache/modules/libphp5.so
00b9b000-00bcc000 rwxp 001e3000 03:07 139403 /opt/apache/modules/libphp5.so
00bcc000-00be6000 rwxp 00bcc000 00:00 0
00c64000-00c86000 r-xp 00000000 03:05 692886 /usr/lib/libpng12.so.0.1.2.8
00c86000-00c87000 rwxp 00022000 03:05 692886 /usr/lib/libpng12.so.0.1.2.8
00cf1000-00d04000 r-xp 00000000 03:07 139269 /opt/apache/lib/libaprutil-0.so.0.9.6
00d04000-00d05000 rwxp 00012000 03:07 139269 /opt/apache/lib/libaprutil-0.so.0.9.6
00d05000-01a33000 r-xp 00000000 16:05 409605 /oracle/product/10g/lib/libclntsh.so.10.1
01a33000-01a94000 rwxp 00d2d000 16:05 409605 /oracle/product/10g/lib/libclntsh.so.10.1
01a94000-01aa8000 rwxp 01a94000 00:00 0
01aa8000-01c84000 r-xp 00000000 16:05 213724 /oracle/product/10g/lib/libnnz10.so
01c84000-01caa000 rwxp 001dc000 16:05 213724 /oracle/product/10g/lib/libnnz10.so
01caa000-01cac000 rwxp 01caa000 00:00 0
0437d000-04484000 r-xp 00000000 03:05 691742 /usr/lib/libxml2.so.2.6.19
04484000-0448c000 rwxp 00107000 03:05 691742 /usr/lib/libxml2.so.2.6.19
0448c000-0448d000 rwxp 0448c000 00:00 0
07e7d000-07e8f000 r-xp 00000000 03:06 147474 /lib/libnsl-2.3.5.so
07e8f000-07e90000 r-xp 00011000 03:06 147474 /lib/libnsl-2.3.5.so
07e90000-07e91000 rwxp 00012000 03:06 147474 /lib/libnsl-2.3.5.so
07e91000-07e93000 rwxp 07e91000 00:00 0
08048000-080a9000 r-xp 00000000 03:07 139400 /opt/apache/bin/httpd
080a9000-080ac000 rw-p 00060000 03:07 139400 /opt/apache/bin/httpd
080ac000-080af000 rw-p 080ac000 00:00 0
0969a000-09809000 rw-p 0969a000 00:00 0 [heap]
b7bec000-b7bfa000 rw-s 00000000 00:07 16362 /dev/zero (deleted)
b7bfa000-b7c58000 rw-p b7bfa000 00:00 0
b7c58000-b7cb6000 r--p 00000000 16:05 213342 /oracle/product/10g/oracore/zoneinfo/timezlrg.dat
b7cb6000-b7cd9000 rw-p b7cb6000 00:00 0
b7cd9000-b7cda000 r--p 00d1e000 03:05 694443 /usr/lib/locale/locale-archive
b7cda000-b7ce0000 r--p 00cf6000 03:05 694443 /usr/lib/locale/locale-archive
b7ce0000-b7d0d000 r--p 00cbe000 03:05 694443 /usr/lib/locale/locale-archive
b7d0d000-b7f0d000 r--p 00000000 03:05 694443 /usr/lib/locale/locale-archive
b7f0d000-b7f11000 rw-p b7f0d000 00:00 0
bfc17000-bfc2c000 rwxp bfc17000 00:00 0 [stack]
#
So, what would you gain by linking just one of those libraries statically?
Is you statement based on experience, measurement or something else? There
are many ways to achieve better performance, like disabling .htaccess for
instance or saving sessions to memory (MM module). In other words, even
if you manage to do what you want to do, all that you will save is a few
milliseconds upon Apache startup and nothing else. The price to pay will
be a highly non-standard installation which is hard to extend and
difficult to handle. Hardly worth the effort.
--
http://www.mgogala.com
[Back to original message]
|