Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add env variables for various memory limits #13

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,27 @@ POSTGRES_USER=swirlds
POSTGRES_PASSWORD=password

#### Java Process Settings ####
JAVA_HEAP_MIN=256m
JAVA_HEAP_MAX=2g
JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc*:gc.log"
PLATFORM_JAVA_HEAP_MIN=256m
PLATFORM_JAVA_HEAP_MAX=2g
PLATFORM_JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc*:gc.log"

#### Bind Mount Settings ####
NETWORK_NODE_LOGS_ROOT_PATH=./network-logs/node
APPLICATION_ROOT_PATH=./compose-network/network-node
APPLICATION_CONFIG_PATH=./compose-network/network-node/data/config

#### Network Node Memory Limits ####
NETWORK_NODE_MEM_LIMIT=8gb

#### MirrorNode settings ####
MIRROR_POSTGRES_IMAGE=postgres:13.5-alpine
MIRROR_GRPC_MEM_LIMIT=512m
MIRROR_IMPORTER_MEM_LIMIT=768m
MIRROR_REST_MEM_LIMIT=512m
MIRROR_WEB3_MEM_LIMIT=512m

#### MINIO settings ####
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin


16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
1. `compose-network` folder has the static files needed for starting Local network.
2. `network-logs` folder will be created at runtime and will have all the log files generated after starting local node.

### Steps to change the memory limits and properties
The following environment variables can be changed in the `.env` file for various memory limits
1. Platform
- PLATFORM_JAVA_HEAP_MIN
- PLATFORM_JAVA_HEAP_MAX
2. Consensus node
- NETWORK_NODE_MEM_LIMIT
3. Mirror node
- MIRROR_GRPC_MEM_LIMIT - memory limit for mirror node gRPC
- MIRROR_IMPORTER_MEM_LIMIT - memory limit for mirror node importer
- MIRROR_REST_MEM_LIMIT - memory limit for mirror node rest api
- MIRROR_WEB3_MEM_LIMIT - memory limit for mirror node web3
4. To change `application.properties`, `api-permission.properties` or `bootstrap.properties` properties, update the `APPLICATION_CONFIG_PATH` to the location of updated config folder in `.env` file

**IMPORTANT :** Ensure to do `docker-compose down -v; git clean -xfd; git reset --hard` and then `docker-compose up -d` for the new changes to take any effect.

### NOTE
1. Ensure to use Docker Compose version 1.29.2 on macOS, due to known bug in Docker Compose V2.
2. Ensure the `gRPC FUSE for file sharing` and `Use Docker Compose V2` settings are disabled in the docker settings.
Expand Down
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ services:
mem_limit: "${NETWORK_NODE_MEM_LIMIT}"
memswap_limit: "${NETWORK_NODE_MEM_LIMIT}"
environment:
JAVA_HEAP_MIN: "${JAVA_HEAP_MIN}"
JAVA_HEAP_MAX: "${JAVA_HEAP_MAX}"
JAVA_OPTS: "${JAVA_OPTS}"
JAVA_HEAP_MIN: "${PLATFORM_JAVA_HEAP_MIN}"
JAVA_HEAP_MAX: "${PLATFORM_JAVA_HEAP_MAX}"
JAVA_OPTS: "${PLATFORM_JAVA_OPTS}"
POSTGRES_DB: "${POSTGRES_DB}"
POSTGRES_HOST: "network-node-postgres"
POSTGRES_PORT: "5432"
Expand All @@ -66,7 +66,7 @@ services:
volumes:
- "${NETWORK_NODE_LOGS_ROOT_PATH}/accountBalances:/opt/hgcapp/accountBalances"
- "${NETWORK_NODE_LOGS_ROOT_PATH}/recordStreams:/opt/hgcapp/recordStreams"
- "${APPLICATION_ROOT_PATH}/data/config:/opt/hgcapp/services-hedera/HapiApp2.0/data/config"
- "${APPLICATION_CONFIG_PATH}:/opt/hgcapp/services-hedera/HapiApp2.0/data/config"
- "${NETWORK_NODE_LOGS_ROOT_PATH}/logs:/opt/hgcapp/services-hedera/HapiApp2.0/output"
- "${APPLICATION_ROOT_PATH}/data/keys:/opt/hgcapp/services-hedera/HapiApp2.0/data/keys"
- "${APPLICATION_ROOT_PATH}/data/onboard:/opt/hgcapp/services-hedera/HapiApp2.0/data/onboard"
Expand Down Expand Up @@ -202,8 +202,8 @@ services:
container_name: mirror-node-grpc
restart: unless-stopped
mem_swappiness: 0
mem_limit: 512m
memswap_limit: 512m
mem_limit: "${MIRROR_GRPC_MEM_LIMIT}"
memswap_limit: "${MIRROR_GRPC_MEM_LIMIT}"
depends_on:
network-node:
condition: service_started
Expand All @@ -224,8 +224,8 @@ services:
container_name: mirror-node-importer
restart: unless-stopped
mem_swappiness: 0
mem_limit: 768m
memswap_limit: 768m
mem_limit: "${MIRROR_IMPORTER_MEM_LIMIT}"
memswap_limit: "${MIRROR_IMPORTER_MEM_LIMIT}"
depends_on:
minio:
condition: service_started
Expand All @@ -245,8 +245,8 @@ services:
image: gcr.io/mirrornode/hedera-mirror-rest:0.49.0
container_name: mirror-node-rest
mem_swappiness: 0
mem_limit: 512m
memswap_limit: 512m
mem_limit: "${MIRROR_REST_MEM_LIMIT}"
memswap_limit: "${MIRROR_REST_MEM_LIMIT}"
depends_on:
importer:
condition: service_started
Expand All @@ -265,8 +265,8 @@ services:
image: gcr.io/mirrornode/hedera-mirror-web3:0.49.0
container_name: mirror-node-web3
mem_swappiness: 0
mem_limit: 512m
memswap_limit: 512m
mem_limit: "${MIRROR_WEB3_MEM_LIMIT}"
memswap_limit: "${MIRROR_WEB3_MEM_LIMIT}"
depends_on:
importer:
condition: service_started
Expand Down