Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Table of Contents |
---|
How to optimize your local machine for the Kiuwan Local Analyzer (KLA)
As said before, if your source code contains Java, Javascript and JSP files, there will be 9 steps (rules, metrics and duplication analysis for every technology).
Info |
---|
Every analysis step is accomplished by executing a new JVM. |
Every step in an analysis with the KLA is executed sequentially, following the order below:
For each technology
rule analysis
metrics analysis
clone detection
Report generation, encryption and uploading to Kiuwan cloud
Every step is executed by a “new” JVM and the Kiuwan configuration applies to all of those JVM instances. If your source code contains more than one technology, it will executre each step for each technology.
Here are some things you should consider Below follows some considerations you must bear in mind to properly configure your analyses.
Java Virtual Machine
Every step is performed through the execution of a JVM process.
IMPORTANT for LINUX/UNIX users:
Please check /dev/random configuration of JVMJava 8 (64 bits) or above —either JDK or JRE— is required.
title | For Linux/Unix users |
---|
.
This may produce severe performance problems (java urandom Entropy).Below link will help you to fix it:
https://www.kiuwan.com/docs/display/K5/Analyses+are+very+slow+in+Unix+Linux%2C+or+halt+when+uploading+results+to+KiuwanBy default, KLA comes with pre-configured default values:
max memory to use during every single step
max duration time (timeout) of every single step
These parameters are configured through KLA configuration mechanism, please do not modify KLA scripts to include JVM flags such as -Xmx, use the mechanisms Kiuwan provides.
Single and parallel execution of analyses
Every Kiuwan analysis executes sequentially, i.e. every step is executed sequentially and following the order specified below:
For each technology
rule analysis
metrics analysis
clone detection
Report generation, encryption and uploading to Kiuwan cloud
Every step is executed by a “new” JVM, and Kiuwan configuration applies to all of those JVM instances.
Therefore, those memory-cpu consuming steps may result in full use (near to 100%) of a CPU core.
infoInfo | ||
---|---|---|
| ||
Please check /dev/random configuration of JVM. This may produce severe performance problems (java urandom Entropy). Here is how to fix it: Analyses are very slow in Unix Linux, or halt when uploading results to Kiuwan |
Single and parallel execution of analyses
If the machine running KLA analyses contains more available CPUs, you can run “simultaneous” (or parallel) analyses by executing additional instances of KLA.
In a parallel KLA execution scenario, every running analysis is completely independent from each other, so you can execute multiple analysis provided your machine has enough CPUs.
Memory configuration
By default, the KLA comes pre-configured with the following memory default values (analyzer.properties):
Code Block | ||
---|---|---|
| ||
# Starting size for heap memory (128m = 128 Megabytes) memory.start=128m # Maximum size for heap memory (1024m = 1 Gigabyte) memory.max=1024m # Stack memory, per thread (1024k = 1 Megabyte) stack.size=2048k |
If you notice that your local analysis ends with an Out of Memory (OOM) error, you need to increase the max memory allocated to the JVM (by default, 1Gb1GB).
Below The troubleshooting links below can help you to identify OOM errors:
https://www.kiuwan.com/docs/display/K5/Java + returned + 1https://www.kiuwan.com/docs/display/K5/Out+of+Memory
You can configure Kiuwan to increase memory limits either for the whole installation or per application.
- If you are using Kiuwan GUI, please visit https://www.kiuwan.com/docs/display/K5/Kiuwan+Local+Analyzer+GUI+-+Graphical+User+Interface#KiuwanLocalAnalyzerGUI-GraphicalUserInterface-AnalysisConfigurationtab If you uses CLI , please visit https://www.kiuwan.com/docs/display/K5/Kiuwan+Local+Analyzer+CLI+-+Command+Line+Interface#KiuwanLocalAnalyzerCLI-CommandLineInterface-Mostcommonlyconfiguredparameters
see Kiuwan Local Analyzer GUI - Graphical User Interface#GraphicalUserInterface-AnalysisConfigurationtab - If you are using CLI, see Kiuwan Local Analyzer CLI - Command Line Interface#CommandLineInterface-Mostcommonlyconfiguredparameters
Info | ||
---|---|---|
| ||
Info | ||
Depending on your available physical memory available, OS and JVM version, if you increase the max memory the JVM might not start (please see https://www.kiuwan.com/docs/display/K5/Not+enough+Memory ) . In these cases, stopping unneeded processes (or restarting the machine) can free unneeded allocated memory. Nevertheless, sometimes this does not free memory so you need to test with lower memory values. |
Although you were not getting an OOM, if you notice the process is performing a high activity of JVM garbage collection, this situation may indicate your analysis needs more memory and the performance is suffering due to gc activity. In theses cases, try to increase the max memory, most probably the analysis performance will be faster.
Info |
---|
IMPORTANT: Do not increase indefinitely the memory. If you see that your analysis needs more than 2GB to finish, it might be a clue of an existing memory leak or some other strange situation. In this case, do not hesitate to contact Kiuwan Technical Support and report this situation. |
Timeout configuration
By default, every step of a local analysis is configured to a default max execution time (60 minutes) (analyzer.properties):
Code Block | ||
---|---|---|
| ||
# Timeout to use for max execution time of each analysis step (in msecs) timeout=3600000 |
The default value is often enough for most of the analyses, but depending on several circumstances (code size, memory, ruleset, etc) could not be enough and a timeout error will occur (Timeout killed the subprocess).
If this happens, you can increase the default value.