On Mon, 13 Jun 2005 13:49:49 +0200 Thomas wrote:
TA> while doing performance tuning for my net-snmp-based applications I 
TA> noticed that launching external programs (exec/extend/traphandle) 
TA> currently (5.3.dev) involves the brute-force approach
TA> 
TA> close(1023)       = -1 EBADF (Bad file descriptor)
TA> close(1022)       = -1 EBADF (Bad file descriptor)
TA> ...
TA> close(3)          = -1 EBADF (Bad file descriptor)
TA> 
TA> (see agent/mibgroup/util_funcs.c::get_exec_{output,pipes}) which looks 
TA> safe but wasteful. This takes ~0.1 seconds in sum on my system (*a lot* 
TA> in terms of real-time processing and scalability, even within the 
TA> limitations of external apps), probably even worse on systems with a 
TA> higher RLIMIT_NOFILE.
TA> 
TA> Any thoughts on improving this (e.g. by remembering the open fds)? Or is 
TA> there a good reason to keep it the way it is?

The problem is that we don't know what fds custom modules might have opened,
and we don't want' to pass them to any script. Probably the safest/most
efficient way of dealing with this would be for the agent to create a small
pool (maybe even 1) of child processes, which do nothing but wait for a command
to exec. They close the fds when created, so there is no delay when the exec is
needed. After the exec, the child dies, and the agent creates another. This
also has the performance advantage of getting the fork out of the way earlier
too.

-- 
NOTE: messages sent directly to me, instead of the lists, will be deleted
      unless they are requests for paid consulting services.

Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>

You are lost in a twisty maze of little standards, all different. 


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to