Community

Subscribe
Highlighted

Running out of memory in API call

Greetings.

I am having an issue where I get an error from our filer stating that my request is too big for available memory.

The request I'm making is for the list of volumes and some counters associated with each volume.

We have about 150 volumes that I'm trying to retrieve information on.

This is the error:

Not enough memory to get instances for volume.Use perf-object-get-instances-iter-* calls and/or ask for specific counters to limit the amount of data retrieved

The code I'm using is as follows:

   

    my $inperf = NaElement->new("perf-object-get-instances-iter-start");

    $inperf->child_add_string("objectname", "volume");

    my $counters = NaElement->new("counters");

    $counters->child_add_string("counter","avg_latency");

    $counters->child_add_string("counter","total_ops");

    $counters->child_add_string("counter","read_data");

    $counters->child_add_string("counter","read_latency");

    $counters->child_add_string("counter","read_ops");

    $counters->child_add_string("counter","write_data");

    $counters->child_add_string("counter","write_latency");

    $counters->child_add_string("counter","write_ops");

    $counters->child_add_string("counter","other_latency");

    $counters->child_add_string("counter","other_ops");

    $inperf->child_add($counters);

    my $outperf = $netapp->invoke_elem($inperf);

Is there a better way to get this information from the filer?

Is there a call that I can use that will give me just a list of volumes that I can then parse and query the specific info for each volume with?

Is there other information that I can provide which will help troubleshoot this issue?

Any help or insight will be greatly appreciated.

Cheers,

Mike

Re: Running out of memory in API call

Hi Mike,

You can run the sequence of "volume-list-info-iter-start", "volume-list-info-iter-next" and "volume-list-info-iter-end" APIs (or just "volume-list-info" instead of the three *-iter-* APIs) to get the list of volumes in your system. Once you get the list of volumes, then for each volume you can collect the perf counters by adding the volume name as an input for "instance" parameter.

You need to do something like this:

...

my $involinfo = new NaElement('volume-list-info');

my $outvolinfo = $netapp->invoke_elem($involinfo);

my $volume_info = $outvolinfo->child_get("volumes");

my @volumes= $volume_info->children_get();

foreach $vol (@volumes){

                my $vol_name = $vol->child_get_string("name");

                print  "Getting perf counters for volume name: $vol_name \n";

                my $inperf = NaElement->new("perf-object-get-instances-iter-start");

                $inperf->child_add_string("objectname", "volume");

                my $instances = new NaElement('instances');

                $inperf->child_add($instances);

                $instances->child_add_string('instance', $vol_name);

                my $counters = NaElement->new("counters");

                $counters->child_add_string("counter","avg_latency");

                ... <rest of your code> ...


  } # end of foreach $vol


...

Please let me know if it helped.

Regards,

Sen.

Re: Running out of memory in API call

Hi Sens,

Thank you very much for help.

I used what you suggested and added a little bit to it so that we can process the list in groups. It was taking about one minute and 15 seconds to process the individual files so here is what I ended up doing:

    # Get the list of volumes from the Netapp

    my $involinfo = new NaElement('volume-list-info');

    my $outvolinfo = $netapp->invoke_elem($involinfo);

     # Create an array of volumes

    my $volume_info = $outvolinfo->child_get("volumes");

    my @volumes= $volume_info->children_get();

    # Loop the list of volume names and get the stats for each volume

    #    until there are no more volumes left in the list   

    while (@volumes){

 

        my $inperf = NaElement->new("perf-object-get-instances-iter-start");

        $inperf->child_add_string("objectname", "volume");

 

        my $instances = new NaElement('instances');

        $inperf->child_add($instances);

 

        # Process a subslist of defined number of volumes and remove that sublist from the master list

        my @subvolumes = splice (@volumes , 0, $subListSize);

 

        # Add the volume names of the sublist onto the instances list

        foreach my $vol (@subvolumes){

            my $vol_name = $vol->child_get_string("name");

            print  "volume_stats: Getting perf counters for volume name: $vol_name \n" if ($testing);

            $instances->child_add_string('instance', $vol_name);

        }

  .... rest of code ....

Now we get the list processed in about 4 seconds which is much more acceptable.

Cheers,

Mike

Re: Running out of memory in API call

Great!

Regards,

Sen.