… | |
… | |
20 | # ... do something else until the result is required |
20 | # ... do something else until the result is required |
21 | my @result = $cv->wait; |
21 | my @result = $cv->wait; |
22 | |
22 | |
23 | DESCRIPTION |
23 | DESCRIPTION |
24 | This module implements an alternative "event dispatcher" for Net::SNMP, |
24 | This module implements an alternative "event dispatcher" for Net::SNMP, |
25 | using AnyEvent as a backend. |
25 | using AnyEvent as a backend. This integrates Net::SNMP into AnyEvent. |
26 | |
26 | That means you can make non-blocking Net::SNMP calls and as long as |
27 | This integrates Net::SNMP into AnyEvent: You can make non-blocking |
27 | other parts of your program also use AnyEvent (or some event loop |
28 | Net::SNMP calls and as long as other parts of your program also use |
28 | supported by AnyEvent), they will run in parallel. |
29 | AnyEvent (or some event loop supported by AnyEvent), they will run in |
|
|
30 | parallel. |
|
|
31 | |
29 | |
32 | Also, the Net::SNMP scheduler is very inefficient with respect to both |
30 | Also, the Net::SNMP scheduler is very inefficient with respect to both |
33 | CPU and memory usage. Most AnyEvent backends (including the pure-perl |
31 | CPU and memory usage. Most AnyEvent backends (including the pure-perl |
34 | backend) fare much better than the Net::SNMP dispatcher. |
32 | backend) fare much better than the Net::SNMP dispatcher. |
35 | |
33 | |
|
|
34 | Another major added fetaure of this module over Net::SNMP is automatic |
|
|
35 | rate-adjustments: Net::SNMP is so slow that firing a few thousand |
|
|
36 | requests can cause many timeouts simply because Net::SNMP cannot process |
|
|
37 | the replies in time. This module automatically adapts the send rate to |
|
|
38 | avoid false timeouts caused by slow reply processing. |
|
|
39 | |
36 | A potential disadvantage is that replacing the dispatcher is not at all |
40 | A potential disadvantage of this module is that replacing the dispatcher |
37 | a documented thing to do, so future changes in Net::SNP might break this |
41 | is not at all a documented thing to do, so future changes in Net::SNP |
38 | module (or the many similar ones). |
42 | might break this module (or the many similar ones). |
39 | |
43 | |
40 | This module does not export anything and does not require you to do |
44 | This module does not export anything and does not require you to do |
41 | anything special apart from loading it *before doing any non-blocking |
45 | anything special apart from loading it *before doing any non-blocking |
42 | requests with Net::SNMP*. It is recommended but not required to load |
46 | requests with Net::SNMP*. It is recommended but not required to load |
43 | this module before "Net::SNMP". |
47 | this module before "Net::SNMP". |
… | |
… | |
63 | |
67 | |
64 | Unfortunately, this number depends not only on processing speed and |
68 | Unfortunately, this number depends not only on processing speed and |
65 | load of the machine running Net::SNMP, but also on the network |
69 | load of the machine running Net::SNMP, but also on the network |
66 | latency and the speed of your SNMP agents. |
70 | latency and the speed of your SNMP agents. |
67 | |
71 | |
68 | AnyEvent::SNMP tries to dynamically adjust this number dynamically |
72 | AnyEvent::SNMP tries to dynamically adjust this number upwards and |
69 | upwards and downwards. |
73 | downwards. |
70 | |
74 | |
71 | Increasing $MAX_OUTSTANDING will not automatically use the extra |
75 | Increasing $MAX_OUTSTANDING will not automatically use the extra |
72 | request slots. To increase $MAX_OUTSTANDING and make |
76 | request slots. To increase $MAX_OUTSTANDING and make |
73 | "AnyEvent::SNMP" make use of the extra paralellity, call |
77 | "AnyEvent::SNMP" make use of the extra paralellity, call |
74 | "AnyEvent::SNMP::set_max_outstanding" with the new value, e.g.: |
78 | "AnyEvent::SNMP::set_max_outstanding" with the new value, e.g.: |