Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jan 1999 12:13:34 -0500 (EST)
From:      Alfred Perlstein <bright@hotjobs.com>
To:        Ollivier Robert <roberto@keltia.freenix.fr>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: shared libs question (overlooked in freebsd-questions)
Message-ID:  <Pine.BSF.4.05.9901031206440.37756-100000@bright.fx.genx.net>
In-Reply-To: <19990103124557.A2357@keltia.freenix.fr>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 3 Jan 1999, Ollivier Robert wrote:

> According to Alfred Perlstein:
> >    b) save execution time if many seperate programs are being run that
> >       use the same libraries (for instance a heavily loaded web site
> >       running a lot of CGI programs that share common routines) because
> >       of smaller text segment. (really better shared)
> 
> Last time we talked about this with John Dyson, he said the opposite.
> FreeBSD can share text between statically linked programs better than with
> dynamically linked ones. So if you have many instance of the same program
> (e.g. shells), make the binary static.
> 
> There is a not-so-small price to pay with dynamically linked programs. The
> startup time can be significant and you trash your cache lines when you call a 
> library routine because you don't have locality anymore (the "make test"
> phase of Perl5 is about 20%-30% slower when using a dynamic Perl binary).
> 
> Code inside a shared lib is PIC code and that is slower as well.

recommended linking all of our CGI programs static but was told
 that because we have so many CGIs that use the same library, we
 were thrashing our system because of all the extra code + number
 of distinc programs being loaded.

I didn't do the test myself as i came aboard after the switch was
made, but because of oracle, cig libc and other shared objects i
trhink it made sense in our case.

-Alfred

> 
> >    c) save memory
> 
> Yes and no. Yes because the library is loaded only once and no because a
> static binary will have only the functions you need (with dependencies of
> course) whereas a library is mapped entirely.

Yes, in our case it seemed to make sense as well as deliver observable
results.  As with most things, your milage may vary :)

> -- 
> Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr
> FreeBSD keltia.freenix.fr 3.0-CURRENT #67: Tue Dec 29 20:24:02 CET 1998


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901031206440.37756-100000>