About net-snmp table iterator performance

bai haoquan <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi all,

In the net-snmp website. I find following description : "Through the
get_first_data_point and get_next_data_point hooks,
the table_iterator helper will repeatedly call your hooks to find
the "proper" row of data that needs processing."  Then I
had write a simple example to test the way table_iterator helper working, in
my example I had create a link-list of 200 nodes
to simulate the table. Every node is a struct like below:

*/*My table name is ggsnPicStatsTable, and has three colums which are
ggsnPicIndex, ggsnPicAddress and ggsnPicNbrOfActivePdpContexts*/*
*            *
*             typedef struct ggsnPicStatsTable_full_s       *
*            {*
*                 int    ggsnPicIndex;     /*In my code, it's value is from 1
to 200*/*
*                 int    ggsnPicAddress;     /*In my code, it's value
is 2,4,6,...400,
double the ggsnPicIndex*/ *
*                 int    ggsnPicNbrOfActivePdpContexts;     /*In my code,
it's value is 3,6,9,...900, treble the ggsnPicIndex*/*
*                 struct ggsnPicStatsTable_full_s *next;*
*            }ggsnPicStatsTable_full_t;*
*
*
*Now I start the master agent and my sub-agent, and use some snmp command to
test the way table_iterator helper working, *
*in other words, to test how the function example_table_get_first_data_point
and example_table_get_next_data_point are called. *
*To test this, I add some printf lines in the function
example_table_get_next_data_point,
as below:*
*
*
*
            static netsnmp_variable_list *
            example_table_get_next_data_point (

void **my_loop_context,

void **my_data_context,

netsnmp_variable_list *put_index_data,

netsnmp_iterator_info *mydata__unused)
            {

.......

printf("%d\n",entry->ggsnPicIndex)

........
            }
*
*
*
*And there are some detailed results of my testing shown as below:*
*    1. When I input command "snmptable -v 2c -c public localhost
GGSN-MIB::ggsnPicStatsTable", the output is : *
*       *
*                           ggsnPicAddress
 ggsnPicNbrOfActivePdpContexts*
*           Wrong Type (should be IpAddress): 2       Wrong Type (should be
Gauge32 or Unsigned32): 3*
*           Wrong Type (should be IpAddress): 4       Wrong Type (should be
Gauge32 or Unsigned32): 6*
*           Wrong Type (should be IpAddress): 6       Wrong Type (should be
Gauge32 or Unsigned32): 9*
*           ..........*
*           Wrong Type (should be IpAddress): 400       Wrong Type (should
be Gauge32 or Unsigned32): 600*
*
*
*       you can ignore the warning"Wrong Type (should be IpAddress)", and
just focus the output value which is correct.*
*
*
*       On the other hand the output of my printf in the function
example_table_get_next_data_point  is :
*
*

*
*

 1,2,3,4,5,6,....199,200,1,2,3,....199,200,1,2,3,....,199,200.......1,2,3....199,200,
from
1 to 200, and repeated 200 times.
*
*

*
*

*
*
     2. When I input command "snmpbulkget -v 2c -c public -C n0 -C r50localhost
GGSN-M
IB::ggsnPicIndex
GGSN-M
IB::ggsnPicAddress GGSN-MIB::ggsnPicNbrOfActivePdpContexts",
*
*
         the output is :
*
*

*
*
            GGSN-MIB::ggsnPicIndex.1 = INTEGER: 1
*
*            GGSN-MIB::ggsnPicAddress.1 = Wrong Type (should be IpAddress):
INTEGER: 2*
*            GGSN-MIB::ggsnPicNbrOfActivePdpContexts.1 = Wrong Type (should
be Gauge32 or Unsigned32): INTEGER: 3*
*            GGSN-MIB::ggsnPicIndex.2 = INTEGER: 2*
*            GGSN-MIB::ggsnPicAddress.2 = Wrong Type (should be IpAddress):
INTEGER: 4*
*            GGSN-MIB::ggsnPicNbrOfActivePdpContexts.2 = Wrong Type (should
be Gauge32 or Unsigned32): INTEGER: 6*
*            ........*
*            GGSN-MIB::ggsnPicIndex.50 = INTEGER: 50*
*            GGSN-MIB::ggsnPicAddress.50 = Wrong Type (should be IpAddress):
INTEGER: 100*
*            GGSN-MIB::ggsnPicNbrOfActivePdpContexts.50 = Wrong Type (should
be Gauge32 or Unsigned32): INTEGER: 150*

*        you can ignore the warning"Wrong Type (should be IpAddress)", and
just focus the output value which is correct.*
*
*
*        On the other hand the output of my printf in the function
example_table_get_next_data_point  is :
*
*

*
*

1,2,3,4,5,6,....199,200,1,2,3,....199,200,12,3,....,199,200.......1,2,3....199,200,
from
1 to 200, and repeated 50 times.
*
*

*
*To my understanding, it will cause performance problem when there are mass
of data. I have no idea that why we have to traverse *
*the whole 200 nodes every time to get a value, and in my opinion when we
use the snmptable command,  the operation to get the *
number (n) node should traverse the link-list the number (n-1) node, so I
think the output of the function *
example_table_get_next_data_point
*
*
when use the command snmptable should be as below :
*
*
           1,2,3,4,...........200
*
*
and the total iterations should be 200, but not 200*200, which will has a
strong impact on the efficiency.
*
*

*
Do I have any misunderstanding?  Look forward to your early reply and
some good advices for this problem.

Best Regards!

------------------------------------------------------------------------------
Download Intel&#174; 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-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.