in reply to Re^2: Problem with ithreads
in thread Problem with ithreads
As I said above, I run script and it works as I expected for the first 10-15 minutes. Every worker thread do one request per 3-4 seconds and put result into $result_q. The boss thread gets results from $result_q and prints them. So, if I run script with 50 threads I get about 10-15 results per seond:sub thread_do { threads->self->detach(); my $tid = threads->self->tid(); while (1) { my $url = $task_q->dequeue(); my $ua = LWP::UserAgent->new(timeout => 3); my $res = $ua->request(HEAD $url); $result_q->enqueue("$tid;$url;" . $res->code() . ";" . $res->m +essage() . ";"); } }
23;200; 31;200; 32;200; 30;200; 34;200; 38;200; 35;500; 21;200; 37;200; 22;500; 27;200; 50;200; 24;200;etc..
30;200; 7;200; 30;200; 7;200; 7;200; 7;200; 30;200; 7;200;I don’t know what happens with other 48 threads. Why they stop? This is the problem, I’m trying to solve and if I sole this problem I’ll be able to create script I need.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Problem with ithreads
by BrowserUk (Patriarch) on Dec 30, 2004 at 11:28 UTC | |
by 2NetFly (Initiate) on Dec 30, 2004 at 14:15 UTC |