On 14 February 2012 15:35, Francois Bouchard <francois.bouch...@mpbc.ca> wrote:
> Here is the code for a cached snmp table module.

OK - I've tried compiling and running that module.

The timeout specified in the header file is given as
    #define MPBCRMHALARMTABLE_TIMEOUT  10
and that's exactly what I'm seeing.

The agent generates a log message whenever the load routine
is called, so if I run this in one window, I'd expect see a series
of messages of the form
    mpbcRMHAlarmTable_load: loaded ....
    mpbcRMHAlarmTable_free
    mpbcRMHAlarmTable_load: loaded ....
    mpbcRMHAlarmTable_free
whenever the table is loaded or freed.


If I run a series of GETNEXT requests on this table in a different
window, with a few seconds between them, then I see the following
behaviour:

   snmpgetnext ....  mpbcRMHAlarmTable
         agent prints "loaded" message
         client receives response
   sleep 6
   snmpgetnext ....  mpbcRMHAlarmTable
         client receives response - note, nothing printed by the agent
   sleep 6
   snmpgetnext ....  mpbcRMHAlarmTable
         agent prints "free" message
         agent prints "loaded" message
         client receives response
   sleep 60
         agent prints "free" message



Note that when the agent receives a request for something in this
table and the cache is older than the defined timeout (12s > 10s),
then it *does* re-load the data.   This is the expected behaviour.

However the agent does not automatically release the local cache
(i.e. call the 'free' routine) as soon as the timeout has expired.
Instead this is handled by a regular "garbage collection" run
(once a minute),  which will free any stale caches.
   In the meantime, a request that tries to use that cache will
spot that it's expired, and reload the data.

Don't get confused between the granularity of how long the data
is valid for (and hence when incoming requests will trigger a
cache reload),  and the granularity of garbage collection.

Hope this helps

Dave

PS:  Please note that I'll be off-line for the next week or so,
 so if you have any further questions on this, you'll have to
 rely on someone else, or wait for me to get back!

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to