I've an application like the following:
3 different pieces, that run should simultaneously. One is the actual application logic (taking input from a database, so it scans the DB every xx seconds for new entries), the 2nd is a "timeout" engine, that verifies if a specific user/session should be timed out, and the 3rd is a statistics generator, based on the usage of the application by the users.
All these 3 pieces have to run simultaneously, but they were coded as independant daemons.
In a sudden burst of creativity (or stupidity?) I decided to have each one of them be fork()ed off a main script, basically to see if I could. So right now it's working like that, one executable that starts the whole thing. It's running fine that way (no zombies, etc) but I'm still in the development stages, so I don't know what kind of implications this kind of solution will have in "real life" deployment.
Anyway, my question is: should I bother going this way (fork() each piece off a main app), or just run each piece individually, since there is no apparent loss in doing so (is there any GAIN?). I realise that if I go the fork() way, I will have to add better handling of the 3 children. I also read something about having to kill the children every so often and re-spawn it again, otherwise no memory would be freed.
I appreciate any input. I'm not posting any code because this is more of a generic question than a specific one, but if necessary I can post snippets.
cheers.
alex.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.