diff --git a/.gitignore b/.gitignore index b52cbe9b..8924b6e7 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ metric_monitor/datadir private_net/datadir tron-docker.iml bin/ +/single_node/output-directory/ +/metric_monitor/logs/ +/private_net/logs/ diff --git a/metric_monitor/README.md b/metric_monitor/README.md index 69e8e211..106d4f51 100644 --- a/metric_monitor/README.md +++ b/metric_monitor/README.md @@ -11,7 +11,7 @@ Please download and install the latest version of Docker from the official Docke * Docker Installation for [Windows](https://docs.docker.com/docker-for-windows/install/) * Docker Installation for [Linux](https://docs.docker.com/desktop/setup/install/linux/) -Then check the Docker resource settings to ensure it has at least 16GB of memory. +Then check the Docker resource settings to ensure it has at least 16GB of memory per FullNode container. ## Quick start Download the `tron-docker` repository, enter the `metric` directory, and start the services defined in [docker-compose.yml](./docker-compose.yml) using the following command: diff --git a/metric_monitor/docker-compose.yml b/metric_monitor/docker-compose.yml index 2619460c..6ba0480d 100644 --- a/metric_monitor/docker-compose.yml +++ b/metric_monitor/docker-compose.yml @@ -15,8 +15,9 @@ services: volumes: - ../conf:/java-tron/conf - ./datadir:/java-tron/data # mount a local directory to make the blocks data persistent. + - ./logs:/java-tron/logs command: > - -jvm "{-Xmx16g -Xms12g -XX:+UseConcMarkSweepGC -XX:+PrintGC}" -c ./conf/main_net_config.conf -d /java-tron/data + -jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log }" -c ./conf/main_net_config.conf -d /java-tron/data prometheus: image: prom/prometheus:latest diff --git a/private_net/README.md b/private_net/README.md index 1ad3bd39..d3c81f16 100644 --- a/private_net/README.md +++ b/private_net/README.md @@ -20,7 +20,7 @@ Please download and install the latest version of Docker from the official Docke Then check the Docker resource settings to ensure it has at least 3GB of memory per TRON node. -**Notice:** The actual memory consumption for a FullNode depends heavily on your configurations and use case. Factors such as block generation frequency, transactions per second (TPS), and external API request QPS can significantly impact memory usage. To help you get started quickly, the memory consumption under the following guidance should remain below **3GB**. However, for a TRON Mainnet Super Representative (SR) FullNode capable of supporting **2000 TPS**, the maximum memory consumption can reach up to **12GB**. +**Notice:** The actual memory consumption for a FullNode depends heavily on your configurations and use case. Factors such as block generation frequency, transactions per second (TPS), and external API request QPS can significantly impact memory usage. To help you get started quickly, the memory consumption under the following guidance is within **3GB**. However, for a TRON Mainnet Super Representative (SR) FullNode capable of supporting **2000 TPS**, the memory resource per FullNode container should set above **16GB**. ## Quick-Start using Docker diff --git a/private_net/docker-compose.yml b/private_net/docker-compose.yml index 14891f95..f38958a4 100644 --- a/private_net/docker-compose.yml +++ b/private_net/docker-compose.yml @@ -8,15 +8,16 @@ services: deploy: resources: limits: - memory: 12g + memory: 16g ports: - "8090:8090" # for external http API request - "50051:50051" # for external rpc API request volumes: - ../conf:/java-tron/conf - ./datadir:/java-tron/data # mount a local directory to make the blocks data persistent. + - ./logs/tron-witness1:/java-tron/logs # map to host logs command: > - -jvm "{-Xmx12g -Xms3g -XX:+UseConcMarkSweepGC}" -c /java-tron/conf/private_net_config_witness1.conf -d /java-tron/data -w + -jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}" -c /java-tron/conf/private_net_config_witness1.conf -d /java-tron/data -w # tron-witness2: # image: tronprotocol/java-tron:latest @@ -26,11 +27,12 @@ services: # deploy: # resources: # limits: - # memory: 12g + # memory: 16g # volumes: # - ../conf:/java-tron/conf + # - ./logs/tron-witness2:/java-tron/logs # command: > - # -jvm "{-Xmx12g -Xms3g -XX:+UseConcMarkSweepGC}" + # -jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}" # -c /java-tron/conf/private_net_config_witness2.conf # -w tron-node1: @@ -41,11 +43,12 @@ services: deploy: resources: limits: - memory: 12g + memory: 16g volumes: - ../conf:/java-tron/conf + - ./logs/tron-node1:/java-tron/logs command: > - -jvm "{-Xmx12g -Xms3g -XX:+UseConcMarkSweepGC}" -c /java-tron/conf/private_net_config_others.conf + -jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}" -c /java-tron/conf/private_net_config_others.conf # tron-node2: # image: tronprotocol/java-tron:latest @@ -55,11 +58,12 @@ services: # deploy: # resources: # limits: -# memory: 12g +# memory: 16g # volumes: # - ../conf:/java-tron/conf +# - ./logs/tron-node2:/java-tron/logs # command: > -# -jvm "{-Xmx12g -Xms3g -XX:+UseConcMarkSweepGC}" +# -jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}" # -c /java-tron/conf/private_net_config_others.conf networks: tron_private_network: diff --git a/single_node/README.md b/single_node/README.md index 916107ae..490c1c64 100644 --- a/single_node/README.md +++ b/single_node/README.md @@ -23,7 +23,7 @@ Please download and install the latest version of Docker from the official Docke * Docker Installation for [Windows](https://docs.docker.com/docker-for-windows/install/) * Docker Installation for [Linux](https://docs.docker.com/desktop/setup/install/linux/) -Then check the Docker resource settings to ensure it has at least 16GB of memory. +Then check the Docker resource settings to ensure it has at least 16GB of memory per FullNode container. ## Get Docker image There are two ways to obtain the TRON image: @@ -69,7 +69,7 @@ docker run --name tron-node -d -p 8090:8090 -p 8091:8091 -p 18888:18888 -p 18888 -v /host/path/datadir:/java-tron/data \ -v /host/path/logs:/java-tron/logs \ tronprotocol/java-tron \ - -jvm "{-Xmx16g -Xms12g -XX:+UseConcMarkSweepGC}" \ + -jvm "{-Xmx12g -XX:+UseConcMarkSweepGC}" \ -c /java-tron/conf/config-localtest.conf \ -d /java-tron/data \ -w @@ -79,7 +79,7 @@ In the example above, the host file `/host/path/conf/config-localtest.conf` will Logs generated by docker container will be mapped to your `/host/path/logs`. Flags after `tronprotocol/java-tron` are used for java-tron start-up arguments: -- `-jvm` used for java virtual machine, the parameters must be enclosed in double quotes and braces. `"{-Xmx16g -Xms12g}"` sets the maximum heap size to 16GB. If you want to set up a long run FullNode, please use the best practice jvm flags with `"{-Xmx16g -Xms12g XX:ReservedCodeCacheSize=256m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log -XX:+UseConcMarkSweepGC -XX:NewRatio=2 -XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70}"`. +- `-jvm` used for java virtual machine, the parameters must be enclosed in double quotes and braces. `"{-Xmx12g}"` sets the maximum heap size to 12GB. If you want to set up a long run FullNode, please use the best practice jvm flags with `"{-Xmx12g -Xmn2g XX:ReservedCodeCacheSize=256m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:MaxDirectMemorySize=1G -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log -XX:+UseConcMarkSweepGC -XX:NewRatio=2 -XX:+CMSScavengeBeforeRemark -XX:+ParallelRefProcEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70}"`. - `-c` defines the configuration file to use. - `-d` defines the database file to use. You can mount a directory for `datadir` with snapshots. This can save time by syncing from a near-latest block number. Please refer to [**Fullnode and Lite-Fullnode**](https://tronprotocol.github.io/documentation-en/using_javatron/backup_restore/#fullnode-data-snapshot) for Mainnet data. For the Nile testnet, you can download the snapshot [here](https://database.nileex.io/). - `-w` means to start as a witness. You need to fill the `localwitness` field with private keys in configure file. Refer to the [**Run as Witness**](https://tronprotocol.github.io/documentation-en/using_javatron/installing_javatron/#startup-a-fullnode-that-produces-blocks). If you want to use keystore + password method, make sure the keystore is inside the mounted directory and remove `-d` to interact with console for password input.