Skip to content

Commit edb66b1

Browse files
authored
Merge pull request #535 from JohT/feature/modularize-neo4j-configuration-and-simplify-memory-increases
Modularize Neo4j configuration to support profile changes
2 parents 64a2dca + e582aaa commit edb66b1

20 files changed

Lines changed: 707 additions & 120 deletions

COMMANDS.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [Validate Links in Markdown](#validate-links-in-markdown)
2020
- [Manual Setup](#manual-setup)
2121
- [Setup Neo4j Graph Database](#setup-neo4j-graph-database)
22+
- [Change Neo4j configuration template](#change-neo4j-configuration-template)
2223
- [Start Neo4j Graph Database](#start-neo4j-graph-database)
2324
- [Setup jQAssistant Java Code Analyzer](#setup-jqassistant-java-code-analyzer)
2425
- [Download Maven Artifacts to analyze](#download-maven-artifacts-to-analyze)
@@ -51,13 +52,16 @@
5152

5253
## Start an Analysis
5354

54-
An analysis is started with the script [analyze.sh](./scripts/analysis/analyze.sh).
55+
Before starting an analysis, setup your analysis as described in the [Getting Started](./GETTING_STARTED.md) guide.
56+
An analysis is then started with the script [analyze.sh](./scripts/analysis/analyze.sh).
5557
To run all analysis steps simple execute the following command:
5658

5759
```shell
5860
./../../scripts/analysis/analyze.sh
5961
```
6062

63+
**Hint:** Within the analysis workspace directory you can simply run `analyze.sh` directly without the `../../` prefix since the script is also available in the analysis workspace.
64+
6165
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps for a Java Project.
6266
👉 See [scripts/examples/analyzeReactRouter.sh](./scripts/examples/analyzeReactRouter.sh) as an example script that combines all the above steps for a Typescript Project.
6367
👉 See [Code Structure Analysis Pipeline](./.github/workflows/internal-java-code-analysis.yml) on how to do this within a GitHub Actions Workflow.
@@ -183,11 +187,23 @@ If any of the script are not allowed to be executed use `chmod +x ./scripts/` fo
183187
Use [setupNeo4j.sh](./scripts/setupNeo4j.sh) to download [Neo4j](https://neo4j.com/download-center) and install the plugins [APOC](https://neo4j.com/labs/apoc/4.4) and [Graph Data Science](https://neo4j.com/product/graph-data-science).
184188
This script requires the environment variable NEO4J_INITIAL_PASSWORD to be set. It sets the initial password with a temporary `NEO4J_HOME` environment variable to not interfere with a possibly globally installed Neo4j installation.
185189

190+
### Change Neo4j configuration template
191+
192+
Use [configureNeo4j.sh](./scripts/configureNeo4j.sh) to apply a different Neo4j configuration template from the [scripts/configuration](./scripts/configuration/) directory. This can be useful to optimize Neo4j for different workloads. Example:
193+
194+
```shell
195+
NEO4J_CONFIG_TEMPLATE=template-neo4j-high-memory.conf ./scripts/configureNeo4j.sh
196+
```
197+
198+
**Hint:** In case you want to switch to the high memory profile as in the example, there is a simpler solution. Just run `useNeo4jHighMemoryProfile.sh` from the analysis workspace directory which will set the environment variable `NEO4J_CONFIG_TEMPLATE` and run `configureNeo4j.sh` for you.
199+
186200
### Start Neo4j Graph Database
187201

188202
Use [startNeo4j.sh](./scripts/startNeo4j.sh) to start the locally installed [Neo4j](https://neo4j.com/download-center) Graph database.
189203
It runs the script with a temporary `NEO4J_HOME` environment variable to not interfere with a possibly globally installed Neo4j installation.
190204

205+
**Hint:** Within the analysis workspace directory you can simply run `startNeo4j.sh` directly without the `../../` prefix since the script is also available in the analysis workspace.
206+
191207
### Setup jQAssistant Java Code Analyzer
192208

193209
Use [setupJQAssistant.sh](./scripts/setupJQAssistant.sh) to download [jQAssistant](https://jqassistant.github.io/jqassistant/current).
@@ -346,6 +362,8 @@ execute_cypher ./cypher/Get_Graph_Data_Science_Library_Version.cypher a=1
346362

347363
Use [stopNeo4j.sh](./scripts/stopNeo4j.sh) to stop the locally running Neo4j Graph Database. It does nothing if the database is already stopped. It runs the script with a temporary `NEO4J_HOME` environment variable to not interfere with a possibly globally installed Neo4j installation.
348364

365+
**Hint:** Within the analysis workspace directory you can run `stopNeo4j.sh` directly without the `../../` prefix since the script is also directly available in the analysis workspace.
366+
349367
## Jupyter Notebook
350368

351369
### Create a report with executeJupyterNotebookReport.sh

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ The [Code Structure Analysis Pipeline](./.github/workflows/internal-java-code-an
249249
ENABLE_JUPYTER_NOTEBOOK_PDF_GENERATION=true ./../../scripts/analysis/analyze.sh
250250
```
251251

252-
- How can i disable git log data import?
252+
- How can I disable git log data import?
253253
👉 Set environment variable `IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT` to `none`. Example:
254254

255255
```shell
@@ -272,34 +272,41 @@ The [Code Structure Analysis Pipeline](./.github/workflows/internal-java-code-an
272272
👉 The custom Jupyter Notebook metadata property `code_graph_analysis_pipeline_data_validation` can be set to choose a query from [cypher/Validation](./cypher/Validation) that will be executed preliminary to the notebook. If the query leads to at least one result, the validation succeeds and the notebook will be run. If the query leads to no result, the notebook will be skipped.
273273
For more details see [Data Availability Validation](./COMMANDS.md#data-availability-validation).
274274

275-
- How can i increase the heap memory when scanning large Typescript projects?
275+
- How can I increase the heap memory when scanning large Typescript projects?
276276
👉 Use the environment variable TYPESCRIPT_SCAN_HEAP_MEMORY in megabyte (default = 4096):
277277

278278
```shell
279279
TYPESCRIPT_SCAN_HEAP_MEMORY=16384 ./../../scripts/analysis/analyze.sh
280280
```
281281

282-
- How can i continue on errors when scanning Typescript projects instead of cancelling the whole analysis?
282+
- How can I continue on errors when scanning Typescript projects instead of cancelling the whole analysis?
283283
👉 Use the profile `Neo4j-latest-continue-on-scan-errors` (default = `Neo4j-latest`):
284284

285285
```shell
286286
./../../scripts/analysis/analyze.sh --profile Neo4j-latest-continue-on-scan-errors
287287
```
288288

289-
- How can i reduce the memory (RAM) consumption?
289+
- How can I reduce the memory (RAM) consumption?
290290
👉 Use the profile `Neo4j-latest-low-memory` (default = `Neo4j-latest`):
291291

292292
```shell
293293
./../../scripts/analysis/analyze.sh --profile Neo4j-latest-low-memory
294294
```
295295

296-
- How can i increase the memory (RAM) consumption?
296+
- How can I increase the memory (RAM) consumption?
297297
👉 Use the profile `Neo4j-latest-high-memory` (default = `Neo4j-latest`):
298298

299299
```shell
300300
./../../scripts/analysis/analyze.sh --profile Neo4j-latest-high-memory
301301
```
302302

303+
- How can i increase the memory (RAM) consumption afterwards, when the setup is already done?
304+
👉 Simply run `useNeo4jHighMemoryProfile.sh` in your analysis working directory, or:
305+
306+
```shell
307+
./../../scripts/useNeo4jHighMemoryProfile.sh
308+
```
309+
303310
## 🕸 Web References
304311

305312
- [code-graph-analysis-examples](https://github.com/JohT/code-graph-analysis-examples)

init.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ mkdir -p "./${SOURCE_DIRECTORY}"
7979
createForwardingScript "./../../scripts/analysis/analyze.sh"
8080
createForwardingScript "./../../scripts/startNeo4j.sh"
8181
createForwardingScript "./../../scripts/stopNeo4j.sh"
82+
createForwardingScript "./../../scripts/useNeo4jHighMemoryProfile.sh"
8283

8384
source "${SCRIPTS_DIR}/scripts/checkCompatibility.sh"
8485

scripts/configuration/template-neo4j-high-memory.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
# The following static configuration entries were taken from "template-neo4j.conf".
3-
41
# Anonymous usage data reporting
52
dbms.usage_report.enabled=false
63

scripts/configuration/template-neo4j-low-memory.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
# The following static configuration entries were taken from "template-neo4j.conf".
3-
41
# Anonymous usage data reporting
52
dbms.usage_report.enabled=false
63

scripts/configuration/template-neo4j-v4-low-memory.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
# The following static configuration entries were taken from "template-neo4j.conf".
3-
41
# List of procedures and user defined functions that are allowed
52
# full access to the database through unsupported/insecure internal APIs.
63
dbms.security.procedures.unrestricted=apoc.*,gds.*

scripts/configuration/template-neo4j-v4.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
# The following static configuration entries were taken from "template-neo4j.conf".
3-
41
# List of procedures and user defined functions that are allowed
52
# full access to the database through unsupported/insecure internal APIs.
63
dbms.security.procedures.unrestricted=apoc.*,gds.*

scripts/configuration/template-neo4j.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
# The following static configuration entries were taken from "template-neo4j.conf".
3-
41
# Anonymous usage data reporting
52
dbms.usage_report.enabled=false
63

0 commit comments

Comments
 (0)