Subject: | performance patch: save sorted entries |
Date: | Tue, 16 Dec 2008 06:31:16 -0500 (EST) |
To: | bug-snmp-extension-passpersist [...] rt.cpan.org |
From: | Kris Beevers <kbeevers [...] voxel.net> |
Hi Sébastien,
I am working with a large deployment and using SNMP to expose a lot of data on some very busy machines. I decided to try your module --- thanks, it's great!
I ran into a bit of an issue exporting large-ish tables (~500 OIDs): the module consumes a _lot_ of CPU. Mostly, I found this was because it was sorting that many OIDs for every getnext request. Using Sort::Key::OID improved things dramatically, but while I was at it I also modified PassPersist to save the sorted array of OIDs and only invalidate it when a new OID or tree is added, rather than re-sorting for every getnext request.
It appears this doesn't really make that big of a performance difference, but every little bit counts. (Probably the biggest remaining killer is the large number of system calls, which is partly an architectural problem with NET-SNMP's pass_persist protocol.)
In any case, here's a patch with the changes I made; feel free to incorporate them if you find them useful.
Thanks again for the good work!
Regards,
Kris
Message body is not shown because sender requested not to inline it.