ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/AnyEvent-SNMP/README
(Generate patch)

Comparing cvsroot/AnyEvent-SNMP/README (file contents):
Revision 1.3 by root, Sun Apr 19 11:06:21 2009 UTC vs.
Revision 1.7 by root, Wed Oct 9 18:22:59 2019 UTC

1NAME 1NAME
2 AnyEvent::SNMP - adaptor to integrate Net::SNMP into Anyevent. 2 AnyEvent::SNMP - adaptor to integrate Net::SNMP into AnyEvent.
3 3
4SYNOPSIS 4SYNOPSIS
5 use AnyEvent::SNMP; 5 use AnyEvent::SNMP;
6 use Net::SNMP; 6 use Net::SNMP;
7 7
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
23DESCRIPTION 23DESCRIPTION
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 feature 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::SNMP
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".
44 48
45GLOBAL VARIABLES 49GLOBAL VARIABLES
46 $AnyEvent::SNMP::MAX_OUTSTANDING (default: 50, dynamic) 50 $AnyEvent::SNMP::MAX_OUTSTANDING (default: 50, dynamic)
51 AnyEvent::SNMP::set_max_outstanding $new_value
47 Use this package variable to restrict the number of outstanding SNMP 52 Use this package variable to restrict the number of outstanding SNMP
48 requests at any point in time. 53 requests at any point in time.
49 54
50 Net::SNMP is very fast at creating and sending SNMP requests, but 55 Net::SNMP is very fast at creating and sending SNMP requests, but
51 much slower at parsing (big, bulk) responses. This makes it easy to 56 much slower at parsing (big, bulk) responses. This makes it easy to
56 in the worst case, this can lead to packet loss, when the receive 61 in the worst case, this can lead to packet loss, when the receive
57 queue overflows and the kernel can no longer accept new packets. 62 queue overflows and the kernel can no longer accept new packets.
58 63
59 To avoid this, you can (and should) limit the number of outstanding 64 To avoid this, you can (and should) limit the number of outstanding
60 requests to a number low enough so that parsing time doesn't 65 requests to a number low enough so that parsing time doesn't
61 introduce noticable delays. 66 introduce noticeable delays.
62 67
63 Unfortunately, this number depends not only on processing speed and 68 Unfortunately, this number depends not only on processing speed and
64 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
65 latency and the speed of your SNMP agents. 70 latency and the speed of your SNMP agents.
66 71
67 AnyEvent::SNMP tries to dynamically adjust this number dynamically 72 AnyEvent::SNMP tries to dynamically adjust this number upwards and
68 upwards and downwards. 73 downwards.
74
75 Increasing $MAX_OUTSTANDING will not automatically use the extra
76 request slots. To increase $MAX_OUTSTANDING and make
77 "AnyEvent::SNMP" make use of the extra parallelity, call
78 "AnyEvent::SNMP::set_max_outstanding" with the new value, e.g.:
79
80 AnyEvent::SNMP::set_max_outstanding 500;
81
82 Although due to the dynamic adjustment, this might have little
83 lasting effect.
69 84
70 Note that you can use Net::SNMP::XS to speed up parsing of responses 85 Note that you can use Net::SNMP::XS to speed up parsing of responses
71 considerably. 86 considerably.
72 87
73 $AnyEvent::SNMP::MIN_RECVQUEUE (default: 4) 88 $AnyEvent::SNMP::MIN_RECVQUEUE (default: 8)
74 $AnyEvent::SNMP::MAX_RECVQUEUE (default: 64) 89 $AnyEvent::SNMP::MAX_RECVQUEUE (default: 64)
75 These values specify the minimum and maximum receive queue length 90 These values specify the minimum and maximum receive queue length
76 (in units of one response packet). 91 (in units of one response packet).
77 92
78 When AnyEvent::SNMP handles $MAX_RECVQUEUE or more packets per 93 When AnyEvent::SNMP handles $MAX_RECVQUEUE or more packets per
79 iteration it will reduce $MAX_OUTSTANDING. If it handles less than 94 iteration it will reduce $MAX_OUTSTANDING. If it handles less than
80 $MIN_RECVQUEUE, it increases $MAX_OUTSTANDING. 95 $MIN_RECVQUEUE, it increases $MAX_OUTSTANDING.
81 96
82 This has the result of adjusting the number of outstanding requests 97 This has the result of adjusting the number of outstanding requests
83 so that the recv queue is between the minimum and maximu, usually. 98 so that the recv queue is between the minimum and maximum, usually.
84 99
85 This algorithm works reasonably well as long as the responses, 100 This algorithm works reasonably well as long as the responses,
86 response latencies and processing times are the same size per packet 101 response latencies and processing times are the same per packet on
87 on average. 102 average.
88 103
89COMPATIBILITY 104COMPATIBILITY
90 This module may be used as a drop in replacement for the 105 This module may be used as a drop in replacement for the
91 Net::SNMP::Dispatcher in existing programs. You can still call 106 Net::SNMP::Dispatcher in existing programs. You can still call
92 "snmp_dispatcher" to start the event-loop, but then you loose the 107 "snmp_dispatcher" to start the event-loop, but then you loose the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines