Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^3: How to tell a child what to do?

by Corion (Pope)
on Sep 21, 2005 at 10:32 UTC ( #493717=note: print w/replies, xml ) Need Help??

in reply to Re^2: How to tell a child what to do?
in thread How to tell a child what to do?

I'm sorry that I misunderstood your problem. I thought that your statement:

The hard part seems to be communicating with children, with one child, I would probably use STDIN/STDOUT, servers like apache have symmetrical children, so I'm kind of lost as to what is the best way to do something like that.

implied that your children are not symmetrical and maybe even distributed across machines, and that children die-ing from unknown reasons might be common.

Maybe you should discuss the scope of your program in the original post to some larger extent - I found DBD::SQLite a very convenient, lightweight and self-contained database, for example.

Replies are listed 'Best First'.
Re^4: How to tell a child what to do?
by Eyck (Priest) on Sep 21, 2005 at 10:50 UTC

    While I used DBD::SQLite in few projects and also found it to be convenient, lightweight, and relatively self-contained when it comes to databases, database is not a solution for communication problem. unless it is, but I just fail to see the reason to go through all the hassle of seting up a database

    Since all the communication is with my own children, setting up an external file ( be it SQLite, which I fail to see how would it be relevant, something lighter like DB_File, or even single file with locking, or even socket with external daemon ), seems a tiny little bit overblown, don't you think?

      No - to me, that does not sound overkill. But that is because I try to avoid IPC in Perl and want to be able to easily audit what the children are doing, and what jobs came when. Also, I like the scalability that a database-based IPC mechanism provides - you can quickly add new machines to the setup which take their jobs from the database.

      You said The hard part seems to be communicating with children, and I tell you a way that makes it trivially easy to communicate with the children, without any ugly interlocking problems and race conditions because of how (SQL) databases work. If you don't want to use what I propose feel free to do so, but don't dismiss it as unusable, as it is easy to implement.

        It is NOT simple to implement, it may seem like that because you've been tinkering with it a lot, but this shouldn't prevent you from noticing how many external dependencies and problem this introduces.

        I find it highly disturbing to see you recommend such unholy measures, as as a high-flying Monk you're sure to sway lot's of unsuspecting youngsters to the dark side. I'm thrilled to see myriads of apps using SQL for iterating through lists and similar tasks.

        Funny that you mention ugly interlocking problems and race conditions that you just wrapped in your bulgy sql libraries,

        solution from Anonymous Monk(Re^4: How to tell a child what to do?) needs no interlocking-avoiding libraries, it's simple, REALLY self-contained ( and not, "well, kind-of self contained, when you factor in dependency on writable filesystem, enough place there, C-based sqlite library, with it's dependencies, correct sqlite file, with correct structure, and don't forget that when you change database format from 2.x to 3.0 your code will just die without en error message" ).

        I don't know how you used SQLite that you never encountered those problems, but you've been very lucky and I envy you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://493717]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2018-06-19 01:45 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.