Best practices for query APIs

Ops Center Analyzer Detail View REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA004-11

Consider the following best practices when using the query API.

Avoid inordinate resource usage on the Analyzer detail view server

Compose your queries by considering the system performance monitor resource usage.

Aborting requests to collect results

If HTTP status code 206 is returned from the query API, use the get request status API to obtain the results until status code 200 is returned. To stop an API request while it is still processing, use the abort request API. If you do not use the abort request API, then the query result is saved in memory until the response is obtained (default: one hour), after the query processing is complete.

Split resource-intensive queries

We do not recommend running a query that might involve a large number of resources. If you must run such a query, use the REST API to check the CPU and memory usage. For best results, divide the request into multiple queries.

For example, the following query involves a large number of resources at a time:
raidMPB[=name rx XXXXXX.*]/raidLdev[=volumeAttribute rx V-VOL]&[=name rx .*]/raidPool[=name rx .*]/raidLdev[=volumeAttribute rx POOL]&[=name rx .*]/raidPG[=name rx .*]

The best practice is to split the query as shown in the following example.

Query1:

raidMPB[=name rx XXXXXX.*]/raidLdev[=volumeAttribute rx V-VOL]&[=name rx .*]/raidPool[=name rx .*]
Query 2:
raidPool[=name rx Pool-names-retrieved-by-query-1]/raidLdev[=volumeAttribute rx POOL]&[=name rx .*]/raidPG[=name rx .*]

Avoid too many filtering conditions

Using a large number of filter conditions can significantly increase the system load. When specifying filter conditions in MQL, use the REST API to monitor the resource usage, and reduce the number of filter conditions accordingly.

Separate the query conditions

For example, the following query involves too many conditions at a time:

raidLdev[=name rx
XXXXXX-00:00:00|XXXXXX-00:00:01|Too-many-conditions|XXXXXX-00:03:FF]&[@totalIOPS
rx b .*][@responseTime rx b .*]

The best practice is to split the conditions as shown in the following example.

Query 1:

raidLdev[=name rx
XXXXXX-00:00:00|XXXXXX-00:00:01|Conditions|XXXXXX-00:01:FF]&[@totalIOPS rx b
.*][@responseTime rx b .*]

Query 2:

raidLdev[=name rx
XXXXXX-00:02:00|XXXXXX-00:02:01|Conditions|XXXXXX-00:03:FF]&[@totalIOPS rx b
.*][@respo

Use a regular expression

For example, the following query involves too many conditions at a time:

raidLdev[=name rx
XXXXXX-00:00:00|XXXXXX-00:00:01|Too-many-conditions|XXXXXX-00:03:FF]&[@totalIOPS
rx b .*][@responseTime rx b .*]

The best practice is to use the regular expression as follows:

 raidLdev[=name rx
XXXXXX-00:0[0-3]:.*]&[@totalIOPS rx b .*][@responseTime rx b
.*]