.. _long-running-api-requests:

Long running API requests
-------------------------

.. _20.1.1|VOSS-695|EKB-5216:

Overview 
.........

To optimize memory utilization and performance, the system is configured so that the API server 
will manage workers with the following defaults:

* After receiving a restart signal, workers have 100 minutes to finish serving requests
* A random restart interval of between 0 and 600 requests per worker (4 workers per node, 4 nodes in a cluster)

The recommended API best practice is to schedule and then poll transactions, since long running requests 
can affect recycling; that is, preferably short requests and then poll.


Polling example
................

To retrieve the status of a given transaction:

::

   GET /api/tool/Transaction/[pkid]/poll/?format=json

The response contains essential status of the transaction, for example:

::

    {
        [pkid]: {
            status: "Success",
            href: "/api/tool/Transaction/[pkid]",
            description: "Name:RDP-auser1857 Description:RD for auser1857"
        }
    }


.. note:: 
    
   Refer to *Poll Transactions* and *Example of an Asynchronous Mutator Transaction with nowait=true* in the API Guide.

