… | |
… | |
29 | |
29 | |
30 | 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 |
31 | CPU and memory usage. Most AnyEvent backends (including the pure-perl |
31 | CPU and memory usage. Most AnyEvent backends (including the pure-perl |
32 | backend) fare much better than the Net::SNMP dispatcher. |
32 | backend) fare much better than the Net::SNMP dispatcher. |
33 | |
33 | |
34 | Another major added fetaure of this module over Net::SNMP is automatic |
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 |
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 |
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 |
37 | the replies in time. This module automatically adapts the send rate to |
38 | avoid false timeouts caused by slow reply processing. |
38 | avoid false timeouts caused by slow reply processing. |
39 | |
39 | |
40 | A potential disadvantage of this module is that replacing the dispatcher |
40 | A potential disadvantage of this module is that replacing the dispatcher |
41 | is not at all a documented thing to do, so future changes in Net::SNP |
41 | is not at all a documented thing to do, so future changes in Net::SNMP |
42 | might break this module (or the many similar ones). |
42 | might break this module (or the many similar ones). |
43 | |
43 | |
44 | 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 |
45 | anything special apart from loading it *before doing any non-blocking |
45 | anything special apart from loading it *before doing any non-blocking |
46 | 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 |
… | |
… | |
61 | 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 |
62 | queue overflows and the kernel can no longer accept new packets. |
62 | queue overflows and the kernel can no longer accept new packets. |
63 | |
63 | |
64 | 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 |
65 | 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 |
66 | introduce noticable delays. |
66 | introduce noticeable delays. |
67 | |
67 | |
68 | Unfortunately, this number depends not only on processing speed and |
68 | Unfortunately, this number depends not only on processing speed and |
69 | 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 |
70 | latency and the speed of your SNMP agents. |
70 | latency and the speed of your SNMP agents. |
71 | |
71 | |
72 | AnyEvent::SNMP tries to dynamically adjust this number upwards and |
72 | AnyEvent::SNMP tries to dynamically adjust this number upwards and |
73 | downwards. |
73 | downwards. |
74 | |
74 | |
75 | Increasing $MAX_OUTSTANDING will not automatically use the extra |
75 | Increasing $MAX_OUTSTANDING will not automatically use the extra |
76 | request slots. To increase $MAX_OUTSTANDING and make |
76 | request slots. To increase $MAX_OUTSTANDING and make |
77 | "AnyEvent::SNMP" make use of the extra paralellity, call |
77 | "AnyEvent::SNMP" make use of the extra parallelity, call |
78 | "AnyEvent::SNMP::set_max_outstanding" with the new value, e.g.: |
78 | "AnyEvent::SNMP::set_max_outstanding" with the new value, e.g.: |
79 | |
79 | |
80 | AnyEvent::SNMP::set_max_outstanding 500; |
80 | AnyEvent::SNMP::set_max_outstanding 500; |
81 | |
81 | |
82 | Although due to the dynamic adjustment, this might have little |
82 | Although due to the dynamic adjustment, this might have little |
… | |
… | |
93 | When AnyEvent::SNMP handles $MAX_RECVQUEUE or more packets per |
93 | When AnyEvent::SNMP handles $MAX_RECVQUEUE or more packets per |
94 | iteration it will reduce $MAX_OUTSTANDING. If it handles less than |
94 | iteration it will reduce $MAX_OUTSTANDING. If it handles less than |
95 | $MIN_RECVQUEUE, it increases $MAX_OUTSTANDING. |
95 | $MIN_RECVQUEUE, it increases $MAX_OUTSTANDING. |
96 | |
96 | |
97 | This has the result of adjusting the number of outstanding requests |
97 | This has the result of adjusting the number of outstanding requests |
98 | 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. |
99 | |
99 | |
100 | This algorithm works reasonably well as long as the responses, |
100 | This algorithm works reasonably well as long as the responses, |
101 | response latencies and processing times are the same size per packet |
101 | response latencies and processing times are the same per packet on |
102 | on average. |
102 | average. |
103 | |
103 | |
104 | COMPATIBILITY |
104 | COMPATIBILITY |
105 | 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 |
106 | Net::SNMP::Dispatcher in existing programs. You can still call |
106 | Net::SNMP::Dispatcher in existing programs. You can still call |
107 | "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 |