On Fri, 25 Nov 2011 10:59:59 -0500 James wrote:
JP> My MIB has a number of statically-sized tables. I have increased the
JP> size of one of those tables to 10,000 rows. (It was less than 1000 rows
JP> previously).
JP> 
JP> At start-up, my code executes
JP> 
JP>     entry = SNMP_MALLOC_TYPEDEF (struct my_table);
JP>     row = netsnmp_tdata_create_row ();
JP>     ...
JP>     netsnmp_tdata_row_add_index (row, ASN_INTEGER, &entry->item, sizeof
JP> (item));
JP>     netsnmp_tdata_add_row (table_data, row);
JP> 
JP> for each row. This takes a long time - about 30 seconds.
JP> 
JP> Is there a way to reduce the time it takes to create this table?
JP> 
JP> (Putting in log statements, e.g. after every 1000 rows, shows the
JP> insertion to be taking order-N^2 time. Would inserting the rows
JP> backwards make any difference?)

What you want to do is set the table container to unsorted at startup, while
you are inserting rows..

  int rc;
  netsnmp_tdata *my_table = netsnmp_tdata_create_table(...);
  CONTAINER_SET_OPTIONS(my_table->container, CONTAINER_KEY_UNSORTED, rc);

  /* insert data here */
  ...

  /* clear unsorted flag */
  CONTAINER_SET_OPTIONS(my_table->container, 0, rc);


JP> net-snmp version: v5.3.0.1. (I am considering updating to a newer
JP> version.  But that won't necessarily solve this issue.)

Hmm.. I only keep as far back as 5.4 around. Not sure when
CONTAINER_SET_OPTIONS was added, but you can give it a shot.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to