in reply to Re: latest on ithreads vs forks?
in thread latest on ithreads vs forks?
So if you take an application that has a fairly large number of modules (and the perl interpretter itself) sitting in pages that aren't going to get overwritten, compared to a fairly small number of pages that are getting actively written to, then preloading is going to save you memory (if a fair portion of the modules will be used in more than one of the forked processes). Not to mention the fact that it will also save you time.
Anyway, here's an example. I've got a web server here with three processes: one is a controller process, and two are worker processes. In the first example, I preload a large number of the perl modules before forking. In the second example, the modules are loaded after forking.
PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 16701 me 0 0 35712 34M 31832 S 0 0.0 1.6 0:02 httpd 18302 me 0 0 41400 40M 33100 S 0 0.0 1.8 0:04 httpd 32301 me 0 0 41932 40M 33776 S 0 0.0 1.9 0:02 httpd PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND 2906 me 0 0 4608 4608 3052 S 0 0.0 0.2 0:00 httpd 2907 me 0 0 35084 34M 5844 S 0 0.0 1.5 0:10 httpd 2908 me 0 0 38804 37M 5880 S 0 0.0 1.7 0:11 httpdPaying careful attention to the SHARE column, you see that the total actual used memory is about 50 megs for the preloading and about 65 megs for the non-preloading. Also, you see that two seconds of processing time in the controller (parent) process when preloading that aren't in the controller process when not preloading. You can think of those two seconds as "shared" seconds, too, in much the same way as the shared memory (because two seconds happens to be about how long it takes to load the large corpus of perl modules involved here).
------------ :Wq Not an editor command: Wq
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: latest on ithreads vs forks?
by pg (Canon) on May 27, 2004 at 02:29 UTC | |
by perrin (Chancellor) on May 27, 2004 at 03:24 UTC | |
by etcshadow (Priest) on May 27, 2004 at 03:44 UTC | |
by liz (Monsignor) on May 29, 2004 at 09:48 UTC | |
by etcshadow (Priest) on May 31, 2004 at 23:15 UTC |