Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/env perl use strict; use warnings; use AnyEvent::Loop; # use the perl loop, not EV use AnyEvent::HTTP; use AnyEvent::Util 'guard'; use BSD::Resource; my $rps = 50; my $timeout = 30; my $duration = 300; my $delay = 60 / $rps / 60; setrlimit RLIMIT_OFILE, 2048, 2048; $AnyEvent::HTTP::MAX_PER_HOST = 1024; my $cv = AE::cv; my $timer = AE::timer 0, $delay, \&do_request; my $wait = AE::timer $duration, 0, sub { undef $timer }; my $halt = AE::timer $duration + $timeout, 0, sub { $cv->send }; $cv->recv; sub do_request { $cv->begin; http_request( GET => 'http://127.0.0.1/test', timeout => $timeout, # I also tried limiting the concurrent requests per connection + with # the following: # persistant => 0, sub { my $guard = guard { $cv->end }; # ... } ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What's causing the busy wait when using AnyEvent::HTTP
by Corion (Patriarch) on Apr 11, 2014 at 06:44 UTC | |
by Anonymous Monk on Apr 11, 2014 at 07:07 UTC | |
|
Re: What's causing the busy wait when using AnyEvent::HTTP
by basiliscos (Pilgrim) on Apr 11, 2014 at 08:41 UTC | |
by Anonymous Monk on Apr 11, 2014 at 11:30 UTC | |
by basiliscos (Pilgrim) on Apr 11, 2014 at 15:41 UTC |