Loading TOC...

MarkLogic 10 Product Documentation
xdmp.queryMeters

xdmp.queryMeters() as Object

Summary

Returns the current value of the resource meters for this query sequence as a JSON node.

Usage Notes

The resource meters returned include:

elapsedTime
The time elapsed since the start of the processing of this query, in the form of a duration.
requests
The number of requests. Request: MarkLogic. Any invocation of a program, whether through an App Server, through a task server, or any other means. In addition, certain client calls to App Servers (for example, loading an XML document through XCC, downloading an image through HTTP, or locking a document through WebDAV) are also requests. The value of requests is normally 1, but can be greater than 1 in some situations such as when error handler is set for the specified app server, or when pre-commit triggers are used for the request.
listCacheHits
The number of successful list cache lookups. The list cache holds search termlists used to accelerate path expressions and text searches.
listCacheMisses
The number of unsuccessful list cache lookups. Each unsuccessful list cache lookup was followed by a disk access to load the search termlist into the cache.
inMemoryListHits
The number of successful list lookups in in-memory stands.
listSize
The aggregate size in bytes read from disk by unsuccessful list cache lookups. Each unsuccessful list cache lookup is followed by a disk access to load the search term list into the cache.
expandedTreeCacheHits
The number of successful expanded tree cache lookups. The expanded tree cache cache holds XML document data in the expanded representation used by the XQuery evaluator.
expandedTreeCacheMisses
The number of unsuccessful expanded tree cache lookups. Each unsuccessful expanded tree lookup was followed by a compressed tree cache lookup to load the expanded tree into the cache.
compressedTreeCacheHits
The number of successful compressed tree cache lookups. The compressed tree cache holds XML document data in the compressed representation stored on disk.
compressedTreeCacheMisses
The number of unsuccessful compressed tree cache lookups. Each unsuccessful compressed tree cache lookup was followed by a disk access to load the compressed tree into the cache.
inMemoryCompressedTreeHits
The number of successful compressed tree lookups in in-memory stands.
compressedTreeSize
The aggregate size in bytes read from disk by unsuccessful compressed tree cache lookups. Each unsuccessful compressed tree cache lookup is followed by a disk access to load the compressed tree into the cache.
valueCacheHits
The number of successful value cache lookups. The value cache is a transient cache that exists only for the duration of one query. It holds typed values, and is used to accelerate the frequent conversion of nodes to typed values.
valueCacheMisses
The number of unsuccessful value cache lookups. Each unsuccessful value cache lookup was followed by a conversion of an XML node to a typed value.
regexpCacheHits
The number of successful regular expression cache lookups. The regular expression cache is a transient cache that exists only for the duration of one query. It holds compiled regular expressions, and is used to accelerate the frequent use of regular expressions during the evaluation of a query.
regexpCacheMisses
The number of unsuccessful regular expression cache lookups. Each unsuccessful regular expression cache lookup was followed by a compilation of a regular expression from source text.
linkCacheHits
The number of successful link cache lookups. The link cache is a transient cache that exists only for the duration of one query. It holds pointers to expanded trees, and is used to accelerate the frequent dereferencing of link nodes.
linkCacheMisses
The number of unsuccessful link cache lookups. Each unsuccessful link cache lookup was followed by a search for the link target tree.
filterHits
The number of successful search filter matches.
filterMisses
The number of unsuccessful search filter matches.
fragmentsAdded
The number of XML fragments added to the database by an update.
fragmentsDeleted
The number of XML fragments deleted from the database by an update.
fsProgramCacheHits
The number of module cache hits from the entire program made from modules on the file system.
fsProgramCacheMisses
The number of module cache misses from the entire program made from modules on the file system.
dbProgramCacheHits
The number of module cache hits from the entire program made from modules in a database (may contain library modules from the special Modules directory).
dbProgramCacheMisses
The number of module cache misses from the entire program made from modules in a database (may contain library modules from the special Modules directory).
envProgramCacheHits
The number of module cache hits from the entire program made from ad hoc XSLT stylesheet nodes.
envProgramCacheMisses
The number of module cache misses from the entire program made from ad hoc XSLT stylesheet nodes.
fsMainModuleSequenceCacheHits
The number of main module cache hits from main modules on the file system.
fsMainModuleSequenceCacheMisses
The number of main module cache misses from main modules on the file system.
dbMainModuleSequenceCacheHits
The number of main module cache hits from main modules in a database.
dbMainModuleSequenceCacheMisses
The number of main module cache misses from main modules in a database.
fsLibraryModuleCacheHits
The number of library module cache hits from library modules on the file system.
fsLibraryModuleCacheMisses
The number of library module cache misses from library modules on the file system.
dbLibraryModuleCacheHits
The number of library module cache hits from library modules from the modules database.
dbLibraryModuleCacheMisses
The number of library module cache misses from library modules from the modules database.
readLocks
The number of read locks.
writeLocks
The number of write locks.
compileTime
The aggregate time in seconds spent compiling a module or a program.
runTime
The aggregate time in seconds spent evaluating/running a module or a program.
lockTime
The aggregate time in seconds forests spend waiting for transactional read and write locks. This time can exceed the run-time.
contemporaneousTimestampTime
The time in seconds spent by queries waiting for the contemporaneous timestamp for which any transaction is known to have committed. When the multi-version concurrency control is set contemporaneous, queries can block waiting for the contemporaneous transactions to fully commit.
indexingTime
The indexing time of documents in seconds before they are inserted into the database.
commitTime
The aggregate commit phase time in seconds.

Some meters are broken down by fragment root and document URI:

fragments
A sequence of fragment elements, each containing:
root
The fragment root name.
expandedTreeCacheHits
A count of successful expanded tree cache lookups for this fragment root.
expandedTreeCacheMisses
A count of unsuccessful expanded tree cache lookups for this fragment root.
documents
A sequence of document elements, each containing:
uri
The document URI.
expandedTreeCacheHits
A count of successful expanded tree cache lookups for this document URI.
expandedTreeCacheMisses
A count of unsuccessful expanded tree cache lookups for this document URI.

There are also meters that measure the query activity per host. There is a qm.hosts member with one qm.host child per host that participates in the query. Each qm.host member contains meters showing the roundTripTime and roundTripCount for communications between the evaluator host and the host referenced in the xdmp.queryMeters output. The qm.hosts member is empty for a single-node cluster.

Certain operations are run concurrently with the timing operations, and if those operations are not actually used in the query, they might not be included in the timings. This occurs for operations like cts.estimate, xdmp.exists, and lexicon calls (for example, cts.elementValues). If you want to see the total timings that include calls that are not used, you can form some other expression with the results of the calls. For example, if you have an expression that calls cts.estimate , you can add 0 to the output, which causes it to be included in the timings (something like cts.estimate(query) + 0).

Example

xdmp.queryMeters()

// Returns results similar to the following:
// {
//   "elapsedTime": "PT0.007101S",
//   "requests": 0,
//   "listCacheHits": 0,
//   "listCacheMisses": 0,
//   "listSize": 0,
//   "inMemoryListHits": 0,
//   "tripleCacheHits": 0,
//   "tripleCacheMisses": 0,
//   "tripleValueCacheHits": 0,
//   "tripleValueCacheMisses": 0,
//   "expandedTreeCacheHits": 0,
//   "expandedTreeCacheMisses": 0,
//   "compressedTreeCacheHits": 0,
//   "compressedTreeCacheMisses": 0,
//   "compressedTreeSize": 0,
//   "inMemoryCompressedTreeHits": 0,
//   "valueCacheHits": 0,
//   "valueCacheMisses": 0,
//   "regexpCacheHits": 0,
//   "regexpCacheMisses": 0,
//   "linkCacheHits": 0,
//   "linkCacheMisses": 0,
//   "filterHits": 0,
//   "filterMisses": 0,
//   "fragmentsAdded": 0,
//   "fragmentsDeleted": 0,
//   "fsProgramCacheHits": 0,
//   "fsProgramCacheMisses": 1,
//   "dbProgramCacheHits": 0,
//   "dbProgramCacheMisses": 0,
//   "envProgramCacheHits": 0,
//   "envProgramCacheMisses": 0,
//   "fsMainModuleSequenceCacheHits": 0,
//   "fsMainModuleSequenceCacheMisses": 0,
//   "dbMainModuleSequenceCacheHits": 0,
//   "dbMainModuleSequenceCacheMisses": 0,
//   "fsLibraryModuleCacheHits": 0,
//   "fsLibraryModuleCacheMisses": 0,
//   "dbLibraryModuleCacheHits": 0,
//   "dbLibraryModuleCacheMisses": 0,
//   "readLocks": 0,
//   "writeLocks": 0,
//   "lockTime": 0,
//   "contemporaneousTimestampTime": 0,
//   "compileTime": 0,
//   "commitTime": 0,
//   "runTime": 0,
//   "indexingTime": 0,
//   "fragments": [ ],
//   "documents": [ ],
//   "hosts": [ ]
// }

Example

fn.count(fn.collection());
xdmp.queryMeters().elapsedTime;

=> PT0.003416S

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.