CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Non blocking IO in perl

 



rprasad
New User

Apr 1, 2014, 12:17 AM

Post #1 of 4 (17059 views)
Non blocking IO in perl Can't Post

Hi
I have a program that runs in a continuous loop
-----
Pick one job from a Redis using BLPOP
Process the job,
LOOP
-----
What I need to do is
While the job is in process get the next job so that I can save the time used up for redis blpop .. how can I do this


FishMonger
Veteran / Moderator

Apr 1, 2014, 6:23 AM

Post #2 of 4 (16901 views)
Re: [rprasad] Non blocking IO in perl [In reply to] Can't Post

Take a look at Proc::Background.
http://search.cpan.org/~bzajac/Proc-Background-1.10/lib/Proc/Background.pm


rprasad
New User

Apr 1, 2014, 11:22 PM

Post #3 of 4 (16896 views)
Re: [FishMonger] Non blocking IO in perl [In reply to] Can't Post

Creating a new "proc" for every job will be a waste.
My system has to execute 300k jobs every hour.


FishMonger
Veteran / Moderator

Apr 2, 2014, 6:11 AM

Post #4 of 4 (16796 views)
Re: [rprasad] Non blocking IO in perl [In reply to] Can't Post

Your question was asking how to run multiple jobs at the same time which is what Proc::Background is used for, but if you want more control over that process, take a look at Parallel::ForkManager.

http://search.cpan.org/~szabgab/Parallel-ForkManager-1.06/lib/Parallel/ForkManager.pm

If that doesn't do what you want, then you'll need to give a better explanation of what you are trying to accomplish and you may need to post a short but complete script which demonstrates your issue.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives