Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Need suggestion on problem to distribute work

by Anonymous Monk
on Jun 15, 2020 at 01:31 UTC ( #11118069=note: print w/replies, xml ) Need Help??


in reply to Need suggestion on problem to distribute work

Right now you are in the thrails of an "XY Problem." You're describing what you need without addressing how to get there.

I focus on this: "currently I have a program that loop and deal with the database within the loop and sends some command to the remote server by connecting to it" ...

So – is "the remote server" the database, or something else? We just can't tell.

Now do this: tell us, first, who your server is and what he is to do. As this process is perceived by his external customers, exactly what is he expected to do?

Then, tell us clearly about each external agent ... "the database server," maybe "the 'remote server'" ... exactly how he connects to each one. If there is some external party upon which "he" depends to accomplish a particular unit of work, please make that clear.

Even though you are obviously momentarily-confused as to how to tackle this problem ... we have all been there. Describe it.

  • Comment on Re: Need suggestion on problem to distribute work

Replies are listed 'Best First'.
Re^2: Need suggestion on problem to distribute work
by smarthacker67 (Beadle) on Jun 15, 2020 at 18:17 UTC
    All Thanks for your responses.

    When I say a remote server is its a freeswitch server to whome I want to send work but its takes time so I cant send more work unless that work reaches to it. I wish to handle it separately.

    I connect with single database only eg I do 200 insertion + 200 times work sending to remote server due to this next bach has to wait. Wish to fork this out from main loop so that separate thread will take care of this,

      I am still not understanding your application. I alluded to this before, but running 200 insertions as a single DB transaction can take about the same time as 1 or 2 single transactions. The transaction overhead is HUGE. Doing 200 insertions at once doesn't take much more time than doing just a single insertion.

      I am not sure that forking or threading is your answer. I now suspect that your DB code is flawed.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11118069]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2020-09-29 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I don’t succeed, I …










    Results (146 votes). Check out past polls.

    Notices?