Skip to content

Commit 41f3e22

Browse files
authored
Merge pull request #303 from JohT/feature/provide-low-memory-profile
Provide low memory profile
2 parents 16d3be3 + a3c6775 commit 41f3e22

13 files changed

+123
-12
lines changed

.github/workflows/java-code-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
ENABLE_JUPYTER_NOTEBOOK_PDF_GENERATION: "true"
123123
IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT: "" # Options: "none", "aggregated", "full". default = "plugin" or ""
124124
run: |
125-
./../../scripts/analysis/analyze.sh
125+
./../../scripts/analysis/analyze.sh --profile Neo4jv5-low-memory
126126
127127
- name: Move reports from the temp to the results directory preserving their surrounding directory
128128
working-directory: temp

.github/workflows/typescript-code-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
ENABLE_JUPYTER_NOTEBOOK_PDF_GENERATION: "true"
137137
IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT: "" # Options: "none", "aggregated", "full". default = "plugin" or ""
138138
run: |
139-
./../../scripts/analysis/analyze.sh
139+
./../../scripts/analysis/analyze.sh --profile Neo4jv5-low-memory
140140
141141
- name: Move reports from the temp to the results directory preserving their surrounding directory
142142
working-directory: temp

COMMANDS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ The [analyze.sh](./scripts/analysis/analyze.sh) command comes with these command
7171
- `--report Csv` only generates CSV reports. This speeds up the report generation and doesn't depend on Python, Jupyter Notebook or any other related dependencies. The default value os `All` to generate all reports. `Jupiter` will only generate Jupyter Notebook reports. `DatabaseCsvExport` exports the whole graph database as a CSV file (performance intense, check if there are security concerns first).
7272

7373
- `--profile Neo4jv4` uses the older long term support (june 2023) version v4.4.x of Neo4j and suitable compatible versions of plugins and JQAssistant. `Neo4jv5` will explicitly select the newest (june 2023) version 5.x of Neo4j. Without setting
74-
a profile, the newest versions will be used. Profiles can be found in the directory [scripts/profiles](./scripts/profiles/).
74+
a profile, the newest versions will be used. Other profiles can be found in the directory [scripts/profiles](./scripts/profiles/).
7575

76-
- `--profile Neo4jv5-continue-on-scan-errors` is based on the default profile (`Neo4jv5`) but uses the jQAssistant configuration template [template-neo4jv5-jqassistant-continue-on-error.yaml](./scripts/configuration/template-neo4jv5-jqassistant-continue-on-error.yaml) to continue on scan error instead of failing fast. This is temporarily useful when there is a known error that needs to be ignored. It is still recommended to use the default profile and fail fast if there is something wrong. Profiles can be found in the directory [scripts/profiles](./scripts/profiles/).
76+
- `--profile Neo4jv5-continue-on-scan-errors` is based on the default profile (`Neo4jv5`) but uses the jQAssistant configuration template [template-neo4jv5-jqassistant-continue-on-error.yaml](./scripts/configuration/template-neo4jv5-jqassistant-continue-on-error.yaml) to continue on scan error instead of failing fast. This is temporarily useful when there is a known error that needs to be ignored. It is still recommended to use the default profile and fail fast if there is something wrong. Other profiles can be found in the directory [scripts/profiles](./scripts/profiles/).
77+
78+
- `--profile Neo4jv5-low-memory` is based on the default profile (`Neo4jv5`) but uses only half of the memory (RAM) as configured in [template-neo4j-low-memory.conf](./scripts/configuration/template-neo4j-low-memory.conf). This is useful for the analysis of smaller codebases with less resources. Other profiles can be found in the directory [scripts/profiles](./scripts/profiles/).
7779

7880
- `--explore` activates the "explore" mode where no reports are generated. Furthermore, Neo4j won't be stopped at the end of the script and will therefore continue running. This makes it easy to just set everything up but then use the running Neo4j server to explore the data manually.
7981

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ The [Code Structure Analysis Pipeline](./.github/workflows/java-code-analysis.ym
243243
./../../scripts/analysis/analyze.sh --profile Neo4jv5-continue-on-scan-errors
244244
```
245245

246+
- How can i reduce the memory (RAM) consumption?
247+
👉 Use the profile `Neo4jv5-low-memory` (default = `Neo4jv5`):
248+
249+
```shell
250+
./../../scripts/analysis/analyze.sh --profile Neo4jv5-low-memory
251+
```
246252

247253
## 🕸 Web References
248254

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
# The following static configuration entries were taken from "template-neo4j.conf".
3+
4+
# List of procedures and user defined functions that are allowed
5+
# full access to the database through unsupported/insecure internal APIs.
6+
dbms.security.procedures.unrestricted=apoc.*,gds.*
7+
8+
# Memory: Java Heap Size
9+
server.memory.heap.initial_size=4g
10+
server.memory.heap.max_size=4g
11+
12+
# Memory: The amount of memory to use for mapping the store files.
13+
server.memory.pagecache.size=1g
14+
15+
# Memory: Exits JVM on the first occurrence of an out-of-memory error.
16+
server.jvm.additional=-XX:+ExitOnOutOfMemoryError
17+
18+
# Memory: Limit the amount of memory that all of the running transaction can consume.
19+
db.memory.transaction.total.max=3g
20+
21+
# Memory: Limit the amount of memory that a single transaction can consume.
22+
db.memory.transaction.max=3g
23+
24+
# Transaction: Retention policy for transaction logs needed to perform recovery and backups.
25+
db.tx_log.rotation.retention_policy=keep_none
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
# The following static configuration entries were taken from "template-neo4j.conf".
3+
4+
# List of procedures and user defined functions that are allowed
5+
# full access to the database through unsupported/insecure internal APIs.
6+
dbms.security.procedures.unrestricted=apoc.*,gds.*
7+
8+
# Memory: Java Heap Size
9+
dbms.memory.heap.initial_size=4g
10+
dbms.memory.heap.max_size=4g
11+
12+
# Memory: The amount of memory to use for mapping the store files.
13+
dbms.memory.pagecache.size=1g
14+
15+
# Memory: Exits JVM on the first occurrence of an out-of-memory error.
16+
dbms.jvm.additional=-XX:+ExitOnOutOfMemoryError
17+
18+
# Memory: Limit the amount of memory that all of the running transaction can consume.
19+
dbms.memory.transaction.global_max_size=3g
20+
21+
# Memory: Limit the amount of memory that a single transaction can consume.
22+
dbms.memory.transaction.max_size=3g
23+
24+
# Transaction: Retention policy for transaction logs needed to perform recovery and backups.
25+
dbms.tx_log.rotation.retention_policy=keep_none

scripts/copyReportsIntoResults.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
# Notice that this scripts needs to be executed within the "temp" directory.
88

9-
# Requires generateJupyterReportReference.sh
10-
119
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
1210
set -o errexit -o pipefail
1311

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# Sets all settings variables for an analysis with Neo4j v4.4.x (long term support (LTS) version as of may 2023).
4+
# The chosen settings are tested to be compatible and working.
5+
6+
NEO4J_VERSION=${NEO4J_VERSION:-"4.4.20"} # Version 4.4.x is the current long term support (LTS) version (may 2023)
7+
NEO4J_HTTP_TRANSACTION_ENDPOINT=${NEO4J_HTTP_TRANSACTION_ENDPOINT:-"db/data/transaction/commit"} # Since Neo4j v5 it is "db/<name>/tx/commit"
8+
NEO4J_CONFIG_TEMPLATE=${NEO4J_CONFIG_TEMPLATE:-"template-neo4j-v4-low-memory.conf"} # Name of the template file ("configuration" folder) for the Neo4j configuration
9+
10+
# Overrideable settings variables for ports (optional, defaults also defined in sub scripts where needed)
11+
# Override them if you need to run multiple neo4j database servers in parallel.
12+
NEO4J_HTTP_PORT=${NEO4J_HTTP_PORT:-"7474"} # Neo4j HTTP API port for executing queries
13+
NEO4J_HTTPS_PORT=${NEO4J_HTTPS_PORT:-"7473"} # Neo4j HTTPS port for encrypted querying
14+
NEO4J_BOLT_PORT=${NEO4J_BOLT_PORT:-"7687"} # Neo4j's own "Bolt Protocol" port
15+
16+
# Awesome Procedures (APOC) Plugin for Neo4j
17+
NEO4J_APOC_PLUGIN_VERSION=${NEO4J_APOC_PLUGIN_VERSION:-"4.4.0.15"} # Version number matches Neo4j version
18+
NEO4J_APOC_PLUGIN_EDITION=${NEO4J_APOC_PLUGIN_EDITION:-"all"} # Since Neo4j v5 only the core edition is maintained
19+
NEO4J_APOC_PLUGIN_GITHUB=${NEO4J_APOC_PLUGIN_GITHUB:-"neo4j-contrib/neo4j-apoc-procedures"} # Location for the old plugins compatible to Neo4j v4
20+
21+
NEO4J_GDS_PLUGIN_VERSION=${NEO4J_GDS_PLUGIN_VERSION:-"2.3.4"} # Graph Data Science Plugin Version 2.3.x is compatible with Neo4j 4.4.x
22+
NEO4J_OPEN_GDS_PLUGIN_VERSION=${NEO4J_OPEN_GDS_PLUGIN_VERSION:-"2.6.8"} # Open package variant of the graph-data-science plugin for Neo4j (https://github.com/JohT/open-graph-data-science-packaging). Since version 2.4. compatible with Neo4j 5.x.
23+
NEO4J_GDS_PLUGIN_EDITION=${NEO4J_GDS_PLUGIN_EDITION:-"open"} # Graph Data Science Plugin Edition: "open" for OpenGDS, "full" for the full version with Neo4j license
24+
25+
JQASSISTANT_CLI_VERSION=${JQASSISTANT_CLI_VERSION:-"1.12.2"} # Version number of the jQAssistant command line interface. Version 1.12.2 is compatible with Neo4j v4
26+
JQASSISTANT_CLI_ARTIFACT=${JQASSISTANT_CLI_ARTIFACT:-"jqassistant-commandline-neo4jv4"}
27+
JQASSISTANT_CONFIG_TEMPLATE=${JQASSISTANT_CONFIG_TEMPLATE:-"template-neo4jv4-jqassistant.yaml"} # Name of the template file for the jqassistant configuration

scripts/profiles/Neo4jv4.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
NEO4J_VERSION=${NEO4J_VERSION:-"4.4.20"} # Version 4.4.x is the current long term support (LTS) version (may 2023)
77
NEO4J_HTTP_TRANSACTION_ENDPOINT=${NEO4J_HTTP_TRANSACTION_ENDPOINT:-"db/data/transaction/commit"} # Since Neo4j v5 it is "db/<name>/tx/commit"
8+
NEO4J_CONFIG_TEMPLATE=${NEO4J_CONFIG_TEMPLATE:-"template-neo4j-v4.conf"} # Name of the template file ("configuration" folder) for the Neo4j configuration
89

910
# Overrideable settings variables for ports (optional, defaults also defined in sub scripts where needed)
1011
# Override them if you need to run multiple neo4j database servers in parallel.

scripts/profiles/Neo4jv5-continue-on-scan-errors.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
NEO4J_VERSION=${NEO4J_VERSION:-"5.23.0"} # Version 5.9.0 is the current version of june 2023
77
NEO4J_HTTP_TRANSACTION_ENDPOINT=${NEO4J_HTTP_TRANSACTION_ENDPOINT:-"db/neo4j/tx/commit"} # Since Neo4j v5 it is "db/<name>/tx/commit"
8+
NEO4J_CONFIG_TEMPLATE=${NEO4J_CONFIG_TEMPLATE:-"template-neo4j.conf"} # Name of the template file ("configuration" folder) for the Neo4j configuration
89

910
# Overrideable settings variables for ports (optional, defaults also defined in sub scripts where needed)
1011
# Override them if you need to run multiple neo4j database servers in parallel.

0 commit comments

Comments
 (0)