Disclaimer: This document serves as a general guideline for scanner sizing when enabling Mend Reachability. Actual resource requirements may vary significantly based on repository size and complexity, number of supported languages detected, dependency graph depth, and specific infrastructure constraints. Teams should adapt these recommendations to their unique environment and validate all sizing decisions against observed scan metrics in their specific deployment context.
This guidance mostly applies to self-hosted repo integration deployments where the scanner runs in customer-managed infrastructure. For Mend-hosted environments, scanner resources are managed by Mend.
Reachability analysis runs as its own JVM process inside the scanner container, after dependency resolution finishes. By default, this JVM can use up to 25% of the container memory for its heap. Setting MEND_SCA_REACHABILITY_MAX_RAM_PERCENTAGE raises that share. Reachability then gets more heap without a larger container.
Version Requirements
|
Component |
Minimum version |
Purpose |
|---|---|---|
|
SCA wrapper |
26.10.1.2 |
Support for |
|
Mend for GitHub Enterprise |
26.10.1.2 |
First release that includes this SCA wrapper |
|
Reachability engine |
26.10.1.0 |
Enables the memory use that the sizing below assumes, plus the |
The SCA wrapper version appears as agent_version in every scanner log line, for example agent_version=26.10.1.2.
Earlier Reachability engine versions use more memory during reachability analysis and are more likely to fail with out-of-memory errors.
By default, the scanner updates the Reachability engine to the latest version each time the scanner container starts. The scanner logs show the update with entries like:
[INFO] com.wss.github.scanner.service.ScaWrapper - [CTX=...;SCAN_CTX=...;SCAN_ID=...] [agent=sca, agent_version=26.10.1.2, command=Scan, engine=npm, level=info, state=ENGINE_UPDATE] Updating Reachability
[DEBUG] com.wss.github.scanner.service.ScaWrapper - [CTX=...;SCAN_CTX=...;SCAN_ID=...] [agent=sca, agent_version=26.10.1.2, command=Scan, engine=npm, level=debug, state=ENGINE_UPDATE] trying to download persisted Reachability engine
[DEBUG] com.wss.github.scanner.service.ScaWrapper - [CTX=...;SCAN_CTX=...;SCAN_ID=...] [agent=sca, agent_version=26.10.1.2, command=Scan, engine=npm, level=debug, state=ENGINE_UPDATE] updating reachability utilities
To disable the automatic update, contact your Mend Customer Success Manager. With the update disabled, confirm that the engine version meets the requirement above before applying this sizing.
To confirm the engine version, look in the scanner logs for the reachability-core version entry:
[DEBUG] com.wss.github.scanner.service.ScaWrapper - [CTX=...;SCAN_CTX=...;SCAN_ID=...] [agent=sca, agent_version=26.10.1.2, command=Scan, engine=npm, level=debug, state=UTILITY_UPDATE] [Reachability] 21:18:44.634 [main] INFO c.m.p.common.client.PrioritizeClient -- Version Info: {groupId=com.mend.analysis, artifactId=reachability-core, version=26.10.1.0}
The version value is the engine version. This entry appears whether or not the automatic update is enabled.
Reachability Heap Setting
Set the environment variable MEND_SCA_REACHABILITY_MAX_RAM_PERCENTAGE on the scanner container, not the controller. The recommended value is 50.
-
Set a memory limit on the scanner container. The JVM calculates the percentage from the container's memory limit. Without a limit, the JVM calculates the percentage from the node's memory, and the Reachability heap can exceed the memory available to the pod.
-
The setting applies only to the Reachability JVM. The Unified Agent, the scanner's own JVM, and Java build tools such as Maven and sbt keep their current memory settings.
-
Accepted values are 10 to 75, and decimals are allowed. An invalid or out-of-range value is ignored and logged as a warning. The scan then continues with the 25% default.
-
Values above 50 leave too little memory for the other processes in the container, and the pod can run out of memory.
At 50, the Reachability heap is half the container memory. For example, a 24 GB scanner gives Reachability 12 GB of heap instead of 6 GB.
Scanner Pod Memory Sizing
The values below assume MEND_SCA_REACHABILITY_MAX_RAM_PERCENTAGE=50.
-
Starting allocation: the larger of these values:
-
Current memory.
-
16 GB.
At the 50% setting, the 16 GB minimum gives the Reachability engine at least 8 GB of JVM heap.
-
Examples:
-
Scanners currently at 12 GB should start at 16 GB.
-
Scanners at 16 GB or more keep their current allocation. Their Reachability heap doubles.
-
-
-
Fine-tuning: After running reachability scans on the largest repositories, adjust the allocation using scan metrics (see "How to Observe Memory Usage" below).
-
Target allocation: the larger of these values:
-
The memory allocation before Reachability was enabled.
-
16 GB.
-
Highest observed memory value x 1.4 x 2. The observed value is JVM heap. Multiplying by 2 converts it to container memory at the 50% setting. The 1.4 factor adds a 40% buffer above the observed peak. Use the value from a scan in which every language completed (see "Reading Memory from Scanner Logs" below).
The formula covers only the memory the Reachability engine needs. Other functions in the scanner container still need the memory the scanner had before Reachability was enabled.
-
Examples:
-
A scanner that ran at 16 GB before Reachability, with an observed peak of 8,000 MB, gives 8,000 x 1.4 x 2 = 22,400 MB. The target allocation is about 22 GB.
-
A scanner that ran at 24 GB before Reachability, with an observed peak of 5,000 MB, gives 14,000 MB from the formula. The target allocation stays at 24 GB.
-
-
If MEND_SCA_REACHABILITY_MAX_RAM_PERCENTAGE is not set, the Reachability JVM keeps the 25% default. In that case, start at the larger of current memory x 1.25 or 16 GB. Use highest observed memory value x 1.4 x 4 for the target allocation.
CPU
-
CPU is not the bottleneck for reachability. Maintain the current CPU allocation (minimum 4 cores).
-
Important: Adding CPU cores can increase peak memory consumption. If memory is constrained on the largest repositories, avoid increasing CPU allocation, as this may raise memory pressure rather than improve performance.
How to Observe Memory Usage
The method for observing memory usage depends on the scanning mode:
-
Standalone Mend CLI (pipeline scan): The
scanMetrics.jsonfile is generated after each scan and can be used directly to review memory consumption. -
Repo Integration: The scanner runs in an ephemeral container that is destroyed after each scan, so
scanMetrics.jsonis not preserved. Use the scanner logs instead (see below).
Reading Memory from Scanner Logs (Repo Integration)
Look for log entries like:
[Reachability] ... INFO ... -- Memory at reachability analysis start: 240MB
[Reachability] ... INFO ... -- Memory at reachability analysis end: 74MB
Important notes on interpreting these values:
-
The reported value is the JVM committed heap. It reflects how much heap memory the JVM has claimed from the OS. It is not a precise consumption measurement, but it serves as a directional signal for sizing purposes.
-
Multiple start/end pairs will appear per scan. One pair is logged per supported language detected in the repository. Each pair follows a
Started running prioritize service for {language}log line. If more pairs than expected appear, the scanner may have run more than once (e.g., per module, or for both base and PR branch). -
To determine the peak for a given scan, take the highest "Memory at reachability analysis end" value across all pairs. Committed heap does not shrink during a scan, so the last (or highest) end value represents the total footprint. Leave out any line with a
(failed: ...)suffix. A failed value shows where the heap ran out, not what the analysis needs. Increase memory, scan again, and size from the successful run.
These entries confirm the heap configuration:
-
Reachability JVM options: [-XX:MaxRAMPercentage=50]confirms that the setting is applied.Reachability JVM options: [] (JVM default heap: 25% of container memory)means the variable is not set. -
Max heap: <n>MBreports the heap limit of the Reachability JVM. A 24 GB scanner at 50% reports about 12,288 MB.
If a language runs out of memory, its end line carries a suffix, for example Memory at reachability analysis end: 4948MB (failed: OutOfMemoryError). The scanner log also shows this warning:
Reachability ran out of memory analyzing <LANGUAGE>; results for this language are missing. Increase MEND_SCA_REACHABILITY_MAX_RAM_PERCENTAGE or the scanner memory
The scan still completes, but it has no Reachability results for that language. The warning appears only in the scanner log.
Before applying the peak x 1.4 x 2 formula, confirm these points in the scanner log:
-
The
Reachability JVM options:line shows-XX:MaxRAMPercentage=50. If it shows[], the variable is not applied, and the 25% fallback formula applies instead. -
The peak is below the
Max heapvalue. A peak at or close toMax heapmeans Reachability used all the heap it had, and its real need may be higher. Increase the scanner memory, scan again, and use the new peak. -
Every language completed, with no
(failed: ...)end lines.
Use the highest end value from that scan as the observed peak.