Can Webservice set a limit memory usage for the user?

1

I'm having problems with a webservice because I make a query that returns me 69300 records and it's okay but already with 69595 records it gives error .

The question: can the webservice set a limit memory usage for who is querying it? I'm consuming 90MB in this query.

  

Update

The program being run is strictly provided by webservice as shown below:

$array  = array ( 
        'key'       => '8b0dc65f996f98fd178a9defd0efa077',
        'module'    => 'imoveis',
        'method'    => 'busca_fotos',
        'field'     => array (
            'CODIGO'    => 'Codigo',
            'IMAGEM_G'  => 'Foto'
        ),
        # 'limit'   => '69300'
    );

    $client = new SoapClient(null, array (
        'uri' => 'http://soap.imo.bi/',
        'location' => 'http://soap.imo.bi/soap.dll',
        'trace' => 'trace'
    ));

    $res    = $client->get($array);
    $tot    = count($res);

    echo "<pre>";
         print_r($res);
    echo "</pre>";
    
asked by anonymous 18.01.2015 / 01:01

2 answers

2

The basic question is quite easy to answer: yes, of course, you can. Any program can set limits it wishes. Ideally, especially webservices have limitations to avoid abuse.

But by the link posted it seems the problem there is another. It looks like the server is jammed. Ironically most probably for not imposing usage limits.

Without further information it is difficult to say exactly what is happening but of course the service provided has not been well developed, which is very common. It is very common for staff to test to see if it works but they forget that the most important test is to test to see what happens when it does not work and not to let catastrophic situations occur like the one in the example.

    
18.01.2015 / 01:22
2

Ideally, you set a query bound return limit (where you can be sure that it will not exceed your memory limit) and implement some sort of pagination so that you can browse all results without having to send all of once.

Imagine if a Google search returned all results at once.

Update:

Following the manual of the web service you are using:

  

Parameter: limit

     

String : You can specify the result limit, which can be a simple numeric value or pagination. For pagination, one must   use the x, y format, where x is the record number and and   is the limit of records.

All you need is to use the limit parameter to page the results and pick up one piece at a time. That way you do what you have to do with this "page" of results, discard and part to next.

    
18.01.2015 / 01:16