Issuing cache warming requests to the Dgraph

In a running data domain, you can issue a request to warm up the cache of its Dgraph processes.

To issue the cache-warming request, use the warmCache operation of the Manage Web Service or this Endeca Server command:

endeca-cmd warm-cache-dd <name> --time-limit-sec <sec>
This operation improves performance of the Endeca Server and is useful to run, for instance, after an update for loading data records.

Caching of end-user queries plays an important role in the query performance of the Dgraph process, as it allows the Dgraph to reuse its computation and thus help reduce the user-observable latencies. However, each time there is an update to the index, most of the cache entries become outdated since they depend upon the index version. The Endeca Server provides a cache warming operation to warm the Dgraph cache after updates. The operation obviates the need to create custom warm-up scripts.

You must explicitly issue the cache warming request as it does not run automatically. The only parameter for the operation is the time limit for which the cache warming job is allowed to run. The cache warming operation asks the Dgraph cache to generate a list of representative queries and plays them back to the Endeca Server. It thus warms the Dgraph cache, but does not take more than the specified time. A successful invocation of cache warming operation returns immediately with an empty response and starts the cache warming job in the background. Once the time limit is reached, the cache warming job stops. If during this time you issue any other requests to the Endeca Server, they take priority over cache warming job. If you issue a cache warming operation in an Endeca Server cluster hosting a data domain, the operation runs on all Dgraph nodes serving this data domain.

The cache warming operation takes into account the current Dgraph process usage pattern for selecting the set of representative queries for replay. Note that the existing cache may also contain queries that won't run after the index had changed, for example, because the records schema had changed after an update. The cache warming operation ignores errors from such queries (if they are selected for replay), and proceeds to run other queries in its list. The actual queries replayed by the cache warming operation do not appear in the request log.

To issue a request to warm up the Dgraph cache:

  1. Use a command-line window (for example, open a Command Prompt in Windows) and navigate to the endeca-cmd directory or access the Manage Web Service.
  2. Issue a command to warm the Dgraph cache, similar to the following example:
    endeca-cmd warm-cache-dd MyDD --time-limit-sec 2400
    where:
    • MyDD is the name of the data domain you are creating.
    • --time-limit-sec <sec> is an optional time limit, in seconds. The default time limit is 1800 seconds (30 minutes). If you do not specify the time limit, the cache warming operation uses the default.
    Note: The name of the data domain can include spaces (for example, if it consists of two words). In this case, the name should be enclosed in double quotes. Thereafter, the name should also be enclosed in double quotes when used in other Endeca Server commands.

    If the data domain exists, the Endeca Server starts the Dgraph warming job in the background and runs the list of queries for the specified time. Once the time limit is reached, the cache warming job stops. If, during this time you issue any requests to the Endeca Server, they take priority and are processed before any cache warming queries are processed.

    Alternatively, you can issue the request similar to the following example, with the Manage Web Service:
    <ns1:warmCache xmlns:ns1="http://www.endeca.com/endeca-server/manage/2/0">
        <ns1:name>MyDD</ns1:name>
        <ns1:timeLimitSec>2400</ns1:timeLimitSec>
    </ns1:warmCache>

    This example issues an operation that warms the Dgraph cache for the data domain MyDD and runs for 40 minutes. A successful operation returns an empty response, and the Endeca Server launches the Dgraph warming script in the background.