Re: netsnmp_large_fd_set_resize() sucking cycles

Bill Fenner <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAF4Sogb82Wz2zxMSitPmKOzoMV=9LrTG8stOaOdmP_1Eyzh-mA@mail.gmail.com>
On Mon, Oct 20, 2014 at 9:23 PM, Jono Poff <[email protected]>
wrote:

>  On 18/10/2014 2:44 a.m., Bill Fenner wrote:
>
>  On Thu, Oct 16, 2014 at 9:48 PM, Jono Poff <[email protected]>
> wrote:
>
>>
>> Hi,
>>
>> I'm investigating excessive cpu usage in some server software on Solaris
>> 10.
>>
>> By prstat, the server process is using 13% (out of 25%, since it is a
>> single thread on 4 cores).
>>
>> By Brendan Gregg's hotuser script (see
>> http://www.brendangregg.com/DTrace/hotuser) the function
>> netsnmp_large_fd_set_resize() is using up to 80% of that.
>>
>> By the same script, libnetsnmp.so is using over 80%.
>>
>> The context of the call is that I'm using snmp_select_info() to
>> integrate SNMP into my own event loop which uses select().  (This is
>> pretty much as described under "Own custom event loop" at
>> http://vincent.bernat.im/en/blog/2012-snmp-event-loop.html)
>>
>> netsnmp_large_fd_set_resize() is called from snmp_read() and run_alarms().
>>
>> The app is using net-snmp-5.6.1.1.  Would upgrading the library (not a
>> trivial task) improve the situation?
>>
>> Can anyone suggest what can be done to alleviate this.  64 bit Solaris
>> has a fixed FD_SETSIZE of 64k, so what does
>> netsnmp_large_fd_set_resize() need to resize that for?  Why does it
>> require space for more than 65535 handles?
>>
>
>  It's spending time resizing from 0 to FD_SETSIZE.  The change at
> http://sourceforge.net/p/net-snmp/code/ci/4224cabcb112d0d437f9ca9f4d3430501d1c8750/
> should help you.
>
>    Bill
>
>
>
> Awesome thankyou!  from 80% of total cpu time in this function down to
> 0.8% :D
>
> Just a couple more questions (and I haven't fully tested snmp
> functionality with the change so there may be more, but) ...
>
> Why doesn't the latest version of the library have this patch?
>

It is in 5.7.3.rc1.  Earlier versions don't have it because time travel
doesn't work yet :-)

  Bill


> Why does snmplib recreate the fdset each time?  In a single threaded app
> at least, couldn't this be a static object?
>
> Cheers and thanks again,
> Jono
>
>
>
>
>
> ------------------------------
> This email, including any attachments, is only for the intended recipient.
> It is subject to copyright, is confidential and may be the subject of legal
> or other privilege, none of which is waived or lost by reason of this
> transmission.
> If you are not an intended recipient, you may not use, disseminate,
> distribute or reproduce such email, any attachments, or any part thereof.
> If you have received a message in error, please notify the sender
> immediately and erase all copies of the message and any attachments.
> Unfortunately, we cannot warrant that the email has not been altered or
> corrupted during transmission nor can we guarantee that any email or any
> attachments are free from computer viruses or other conditions which may
> damage or interfere with recipient data, hardware or software. The
> recipient relies upon its own procedures and assumes all risk of use and of
> opening any attachments.
> ------------------------------
>

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.