From: Dean T. <de...@ha...> - 2003-07-15 23:07:20
|
On Monday, Jul 14, 2003, at 20:48 Pacific/Honolulu, Matthew John Darnell wrote: >> Just to throw it out there, long lasting perl daemons leak >> memory. It is something to be aware of, but probably not >> something we should worry about just yet. > > A weekly/nightly reboot would not be a horrible thing. Very little > use from > 8PM - 6AM on a voiecmail, next to none on a Sunday night. I dug up some old TCP server/client perl code I wrote a few years back and merged it with the sample preforking server code from the cookbook. It's a _mostly_ working framework at this point, but missing the Voicemail functionality of course. On startup this "operator" script forks a copy of itself to bind to port 1198, another on 1199 and one each on port 1200 on up until a MAXPORTS condition is met. If bound to port 1198, the child can perform 'management' tasks. The 1199 port is an "are you alive" port that's left over from my previous project - it may or may not be useful. Note that this was more an exercise in re-familiarizing myself with perl TCP sockets than an attempt at any real production code. It is debatable whether this approach or a run-one-script-per-port approach is better. This approach has the disadvantage of building all the functionality into one big script. There may be an advantage in that the parent process can act as a nanny for all the children, reforking a new one if a child dies or automagically killing them if they live too long. -dean |