This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: cgi-bin
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Erik Poupaert <erik dot poupaert at skynet dot be>
- Cc: java at gcc dot gnu dot org
- Date: Sun, 14 Sep 2003 17:13:20 -0400 (EDT)
- Subject: Re: cgi-bin
On Sun, 14 Sep 2003, Erik Poupaert wrote:
> -rwxr-xr-x 1 erik users 2221532 Sep 14 18:33 test.cgi
> -rwxr-xr-x 1 erik users 84064 Sep 14 17:01 webmail.cgi
>
> Frustrating, isn't it?
Indeed. Shared libraries are the way to go, but libgcj.so needs to be
more efficient.
The three important considerations in my mind are (in no particular
order):
1) startup time
2) memory footprint
3) runtime overhead
At the moment, libgcj.so loses on all three :-(
> Actually, webmail.cgi also revolves primarily around printf-ing to stdout
> (apparently cgi doesn't require much more).
CGI is extremely simple and requires no runtime support beyond env vars
and simple I/O. (I once had an employer who created CGI executables in
FORTRAN. They worked remarkably well!)
> > (RH9, maybe?)
> If they have it, they've been really quiet about it.
I grabbed prelink-0.2.0-18.i386.rpm from a RH9 mirror, and tried
prelinking a "Hello, World" executable. The results are impressive!
before:
$ /usr/bin/time ./hello
Hello World
0.11user 0.01system 0:00.11elapsed 100%CPU (0avgtext+0avgdata 0maxresident)
0inputs+0outputs (1631major+158minor)pagefaults 0swaps
after:
$ /usr/bin/time ./hello
Hello World
0.02user 0.02system 0:00.03elapsed 108%CPU (0avgtext+0avgdata 0maxresident)
0inputs+0outputs (864major+193minor)pagefaults 0swaps
$ size hello
text data bss dec hex filename
89951 708 0 90659 16223 hello
Page faults are way down, and quite possibly memory usage as well.
There's still a lot of memory touched due to class registrations
at startup (easy to fix), and GC conservatively scanning all writable
data segments (harder).
Contrast with a static build:
$ size hello.static
text data bss dec hex filename
2216037 365104 371400 2952541 2d0d5d hello.static
$ /usr/bin/time ./hello.static
Hello World
0.04user 0.01system 0:00.04elapsed 111%CPU (0avgtext+0avgdata 0maxresident)
0inputs+0outputs (659major+340minor)pagefaults 0swaps
The prelinked libgcj.so wins!
> # prelink test.cgi
> prelink: /usr/X11R6/bin/uil: Could not parse `/usr/X11R6/bin/uil: error while loading
> shared libraries: libMrm.so.3: cannot open shared object file: No such file or
> directory' prelink: /usr/X11R6/bin/xmanimate: Could not parse
> `/usr/X11R6/bin/xmanimate: error while loading shared libraries: libMrm.so.3: cannot
Hmm, odd that it would look in /usr/X11R6/bin at all. Anyway, it looks as
though you need root privs to run prelink, since it wants to prelink all
dependent libs at once, including those in /lib.
Jeff