Hi folks,

I am trying to optimize an SNMP subagent (connected to NET-SNMP 5.4.2.1 
through AgentX) that is
currently using code generated through mib2c.iterate_access.conf; of 
course this does *not* scale well, worsened by the fact that it runs on 
an extremely slow embedded processor.

The subagent is a thread within a multi-threaded application; the actual 
data is stored as shared data (dynamic data structures) within the 
application itself.
Right now, get_first_data_point and get_next_data point are repeatedly 
called for each operation, going through the entire internal MIB 
database at each operation. Since the MIB indexes are essentially the 
same as the ones within the internal MIB database (i.e. a direct mapping 
would be trivial to implement), I've been wondering if I could access 
the internal database directly.

I read the FAQs and the MFD tutorial, and I got to the conclusion that 
the most efficient way would be to write a custom container that's 
actually a wrapper around my own database functions.
I believe I should implement, among the others, my own .find and 
.find_next functions (which, of course, needs to "handle SNMP's 
lexicographical ordering rules" - as reported in the MFD tutorial).

So straight to the point:
Where can I find some example for a custom container used within MFD?
Given the circumstances, would it be best to use MFD code, or go 
straight to 'container' code (mib2c.container.conf)?
Either way, since it's a multithreaded application, I need to lock the 
database at the beginnin of each SNMP operation, and unlock it at the 
end of it (other threads may alter the data in between, releasing memory 
areas and so on...).
I could not find any hook for this in netsnmp_container, nor did I see 
it anywhere it may fit.

The only place I could see something remotely related to locking would 
be .pre_request and .post_request in netsnmp_baby_steps_access_methods 
(access_multiplexer), but I believe .pre_request (in the baby steps 
access multiplexer, which is further down in the handler chain) is 
called *after* the lookup (in the container table handler).
So, I'm wondering, is my idea of sharing the database with the subagent 
such a bad idea?
Should I write my own "locking handler" and put it on top of the handler 
chain (i.e., inject it last)?

Thank you very much!
Gerlando

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to