-
Type:
Investigation
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Tools and Replicator
-
10
In more details SPM-4299 made the following changes
New feature flag
featureFlagExpressionMemoryTracking : The flag enables expression-level memory usage tracking during query execution. Only takes effect when featureFlagQueryMemoryTracking is also enabled. It is on by default
New Query knobs
internalQueryMaxMemoryUsageBytesPerOperation : Defines the maximum memory all memory-tracked stages of a single operation may collectively use. It has default value max(1GB, 20% of memory available to the process). It can be set at startup (--setParameter) or at runtime (the setParameter command). It is also configurable via Persistent Query Settings (PQS).
internalQueryMaxSingleExpressionMemoryUsageBytes : Defines the maximum memory used by a subset of memory intensive expressions. It is used when the per-operation limit is not used. It has default value 100MB. It can be set at startup (--setParameter) or at runtime (the setParameter command). It is not configurable via PQS.
Error codes
Queries that fail because they exceed the allowed memory usage limit will fail with code ExceededMemoryLimit or QueryExceededMemoryLimitNoDiskUseAllowed if the stage is spillable but allowDiskUse is set to false.
New failure logs
When a query fails on the ExceededMemoryLimit path, it also emits the log "Query exceeded the memory limit" with code 12932700. (The QueryExceededMemoryLimitNoDiskUseAllowed spill path does not emit this log.)
New metrics (serverStatus and OTel)
peakMemoryUsageOperation : Peak memory usage of any single operation since process startup. All time high watermark.
operationsFailedDueToMemoryLimit : Incremented each time an operation is killed for exceeding the memory limit.
configuredMaxMemoryUsageBytesPerOperation : The currently configured per-operation limit.
Explain output change
$project, $addFields, $set, $unset, $replaceRoot, $replaceWith, $match and $lookup in classic engine report expressionEvaluationPeakMemoryBytes in their explain output when verbosity is at least executionStats.
Description of Linked Ticket
This ticket is to update all types of documentation API Guide,
Programming Guide, and Architecture Guide related to the project.