A significant part of memory allocated using -m
to the docker is used by the various process of BrowserStack Code Quality. These include the UI, controller process, and processes involved in the actual analysis of the source code.
From all these processes, the analyzer process using the “ANALYSER_XMX” uses the maximum memory. It is observed in most instances that the ANALYSER_XMX
value is proportional to the actual number of Lines Of Code (LOC) scanned for a repository. The ANALYSER_XMX
value should not be more than 70% of the allocated value for “-m”.
Also, the ANALYSER_XMX
and RISK_XMX
are mutually exclusive for a given analysis.
Furthermore, to quote an example here, a repository with 2.6 million lines of code will require a minimum of 6 to 7 GB ANALYSER_XMX
. But few other factors might impact the ANALYSER_XMX
value. Like, within this repository, there could be a surge of duplication in the code that will demand the ANALYSER_XMX
value to be set to 8 GB and the “-m
” value to set to 12 GB. But such factors may not be known upfront when the docker run command is triggered.
So a general thumb rule to be followed while setting ANALYSER_XMX
value:
- For a repository with less than 1 Million lines of code, that equals 35-37% of the total memory allocated for the container.
- For a repository with less than 3 Million lines of code, that equals 40-42% of the total memory allocated for the container.
- For a repository with less than 5 Million lines of code, that equals 50-55% of the total memory allocated for the container.