Performance of fork on Sol7 vs. Linux seems worse
807567Mar 13 2001 — edited Mar 31 2001Background: I have a server app that currently runs on Linux. It's large footprint: about 110MB. The parent process accepts connections and fork()s off children to service them (this is the way it is - I already know the benefits of threads). There is no exec() in the child - the child is the same binary as the parent and uses the same 110MB of data, etc. This is an important point - about 100MB of that 110MB is read-only data that all the children will use. This turns out to be very efficient because the Linux forking does copy-on-write with the data pages. Each forked child really only takes an additional 4MB or so for it's own unique processing.
Problem: On Linux, I can take a 1GHz PIII w/512MB of RAM and run (i.e. fork) lots of children - I've tested up to 100 with no problems. On Solaris 2.7 on the exact same hardware, I can fork maybe 6 children before the fork starts failing and returning an "not enough space" error. Cursory examination of mem usage looks like each fork() uses a full 110MB of swap rather than just a little. So, how can I get Solaris to do as well as Linux? Do I need tons of swap (on the order of 10GB for 100 children) or can I set things up to behave as efficiently as Linux does? Does the Sparc version of Solaris behave similarly?