From owner-freebsd-hackers Sun Jan 3 09:10:21 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA14098 for freebsd-hackers-outgoing; Sun, 3 Jan 1999 09:10:21 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from bright.fx.genx.net (bright.fx.genx.net [206.64.4.154]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA14092 for ; Sun, 3 Jan 1999 09:10:20 -0800 (PST) (envelope-from bright@hotjobs.com) Received: from localhost (bright@localhost) by bright.fx.genx.net (8.9.1/8.9.1) with ESMTP id MAA46493; Sun, 3 Jan 1999 12:13:34 -0500 (EST) (envelope-from bright@hotjobs.com) X-Authentication-Warning: bright.fx.genx.net: bright owned process doing -bs Date: Sun, 3 Jan 1999 12:13:34 -0500 (EST) From: Alfred Perlstein X-Sender: bright@bright.fx.genx.net To: Ollivier Robert cc: freebsd-hackers@FreeBSD.ORG Subject: Re: shared libs question (overlooked in freebsd-questions) In-Reply-To: <19990103124557.A2357@keltia.freenix.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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