Skip to content
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
2 changes: 1 addition & 1 deletion metric_monitor/docker-compose/tron-fullnode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ services:
- ../output-directory:/java-tron/output-directory # mount a local directory to make the block data persistent.
- ../logs:/java-tron/logs
command: >
-jvm "{-Xmx14g -Xmn1g -XX:MaxDirectMemorySize=1G -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log }" -c ./conf/main_net_config_open_metric.conf
-jvm "{-Xmx14g -Xmn1g -XX:MaxDirectMemorySize=1G}" -c ./conf/main_net_config_open_metric.conf
environment:
- TZ=Asia/Shanghai # The metric and log date will be changed accordingly
8 changes: 4 additions & 4 deletions private_net/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
- ./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 -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}" -c /java-tron/conf/private_net_config_witness1.conf -d /java-tron/data -w

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NIT] Until a change similar to [tronprotocol/java-tron#6918](tronprotocol/java-tron#6918) takes effect, extra care is needed because gc.log is no longer mounted to the host directory. As a result, the GC logs will be lost if the container is removed or recreated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and thanks for linking it — that is exactly the gap tronprotocol/java-tron#6918 closes. It points both vmoptions files at ./logs/gc.log and creates the directory in the launcher before the JVM starts, so once it lands and images are rebuilt, gc.log lands in the mounted logs/ directory next to tron.log on both architectures, with no further change needed here.

The mkdir has to live in the launcher rather than in a RUN mkdir in the Dockerfiles, because JVM logging initialises before java-tron creates ./logs; handling it in the launcher also covers consumers of the plain distribution zip. Verified by applying only the vmoptions half to the arm64 image:

[0.000s][error][logging] Error opening log file './logs/gc.log': No such file or directory
Error: Could not create the Java Virtual Machine.

Until then, the GC log is retrievable with docker cp <container>:/java-tron/gc.log . while the container exists.

I kept the two changes in separate PRs so this one stays reviewable on its own and does not block on a java-tron release. If you would prefer the interim gap closed here instead, say so and I will look at it.

-jvm "{-Xmx12g -Xmn2g}" -c /java-tron/conf/private_net_config_witness1.conf -d /java-tron/data -w

# tron-witness2:
# image: tronprotocol/java-tron:latest
Expand All @@ -32,7 +32,7 @@ services:
# - ../conf:/java-tron/conf
# - ./logs/tron-witness2:/java-tron/logs
# command: >
# -jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}"
# -jvm "{-Xmx12g -Xmn2g}"
# -c /java-tron/conf/private_net_config_witness2.conf
# -w
tron-node1:
Expand All @@ -48,7 +48,7 @@ services:
- ../conf:/java-tron/conf
- ./logs/tron-node1:/java-tron/logs
command: >
-jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}" -c /java-tron/conf/private_net_config_others.conf
-jvm "{-Xmx12g -Xmn2g}" -c /java-tron/conf/private_net_config_others.conf

# tron-node2:
# image: tronprotocol/java-tron:latest
Expand All @@ -63,7 +63,7 @@ services:
# - ../conf:/java-tron/conf
# - ./logs/tron-node2:/java-tron/logs
# command: >
# -jvm "{-Xmx12g -Xmn2g -XX:+UseConcMarkSweepGC -Xloggc:./logs/gc.log}"
# -jvm "{-Xmx12g -Xmn2g}"
# -c /java-tron/conf/private_net_config_others.conf
networks:
tron_private_network:
Expand Down
4 changes: 2 additions & 2 deletions single_node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ services:
- ../logs:/java-tron/logs
- ../output-directory:/java-tron/output-directory
command: >
-jvm "{-Xmx14g -Xms12g -XX:+UseConcMarkSweepGC}"
-jvm "{-Xmx14g -Xms12g}"
-c /java-tron/conf/main_net_config.conf
-d /java-tron/output-directory
-w
Expand All @@ -98,7 +98,7 @@ In the example above, the host file `../conf/main_net_config.conf` will be used.
Logs generated by docker container will be mapped to your `../logs/mainnet/logs`.

Flags in `command` are used for java-tron start-up arguments:
- `-jvm` used for java virtual machine, the parameters must be enclosed in double quotes and braces. `"{-Xmx14g -Xms12g}"` sets the maximum and initial heap size to 14GB and 12GB respectively. If you want to set up a long run FullNode, please use the best practice jvm flags with `"{-Xmx14g -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}"`.
- `-jvm` used for java virtual machine, the parameters must be enclosed in double quotes and braces. `"{-Xmx14g -Xms12g}"` sets the maximum and initial heap size to 14GB and 12GB respectively. If you want to set up a long run FullNode, please use the best practice jvm flags with `"{-Xmx14g -Xmn2g -XX:ReservedCodeCacheSize=256m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:MaxDirectMemorySize=1G -XX:+ParallelRefProcEnabled -XX:+HeapDumpOnOutOfMemoryError}"`. Do not add garbage collector or GC logging options here. The image ships an architecture-specific `bin/java-tron.vmoptions` that already selects a collector: CMS on the amd64/JDK 8 image, ZGC on the arm64/JDK 17 image. Adding them stops the arm64 container from starting, for two different reasons: `-XX:+UseConcMarkSweepGC` was removed in JDK 14, so JDK 17 rejects it outright as an unrecognized option, while `-Xloggc:` is still accepted as a deprecated alias for unified logging but, unlike JDK 8, aborts startup when its target directory does not exist.
- `-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.
Expand Down
2 changes: 1 addition & 1 deletion single_node/docker-compose-configure-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
- ../logs:/java-tron/logs
- ../output-directory:/java-tron/output-directory
command: >
-jvm "{-Xmx14g -Xmn2g -XX:MaxDirectMemorySize=1G -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log}"
-jvm "{-Xmx14g -Xmn2g -XX:MaxDirectMemorySize=1G}"
-c /java-tron/conf/main_net_config.conf
-d /java-tron/output-directory
-w
2 changes: 1 addition & 1 deletion single_node/docker-compose-quick-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ services:
- "18888:18888/udp"
- "50051:50051"
command: >
-jvm "{-Xmx14g -Xmn2g -XX:MaxDirectMemorySize=1G -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log}"
-jvm "{-Xmx14g -Xmn2g -XX:MaxDirectMemorySize=1G}"
2 changes: 1 addition & 1 deletion single_node/docker-compose.fullnode.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ services:
- ../output-directory/mainnet:/java-tron/output-directory
command:
- -jvm
- "{-Xmx14g -Xmn2g -XX:MaxDirectMemorySize=1G -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log }" # Using environment variable for JVM arguments
- "{-Xmx14g -Xmn2g -XX:MaxDirectMemorySize=1G}" # Using environment variable for JVM arguments
- -c
- /java-tron/conf/main_net_config.conf
2 changes: 1 addition & 1 deletion single_node/docker-compose.fullnode.nile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ services:
- ../output-directory/nile:/java-tron/output-directory
command:
- -jvm
- "{-Xmx14g -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log }" # Using environment variable for JVM arguments
- "{-Xmx14g}" # Using environment variable for JVM arguments
- -c
- /java-tron/conf/nile_net_config.conf
2 changes: 1 addition & 1 deletion single_node/docker-compose.fullnode.private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ services:
- ../output-directory/private:/java-tron/output-directory
command:
- -jvm
- "{-Xmx4g -Xms2g -XX:+UseConcMarkSweepGC}" # Using environment variable for JVM arguments
- "{-Xmx4g -Xms2g}" # Using environment variable for JVM arguments
- -c
- /java-tron/conf/private_net_config_others.conf
2 changes: 1 addition & 1 deletion single_node/docker-compose.witness.private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- ../output-directory/private:/java-tron/output-directory
command:
- -jvm
- "{-Xmx4g -Xms2g -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log}" # Using environment variable for JVM arguments
- "{-Xmx4g -Xms2g}" # Using environment variable for JVM arguments
- -c
- /java-tron/conf/private_net_config_witness1.conf
- -w
2 changes: 1 addition & 1 deletion tools/docker/codepipeline/docker-compose.fullnode.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ services:
- ../output-directory:/java-tron/output-directory
command:
- -jvm
- "{-Xmx30g -Xms24g -XX:MaxDirectMemorySize=1G -XX:+UseConcMarkSweepGC -XX:+PrintGC -Xloggc:./logs/gc.log }" # Using environment variable for JVM arguments
- "{-Xmx30g -Xms24g -XX:MaxDirectMemorySize=1G}" # Using environment variable for JVM arguments
- -c
- /java-tron/conf/main_net_config.conf
2 changes: 1 addition & 1 deletion tools/docker/codepipeline/docker-compose.fullnode.nile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ services:
- ./output-directory/nile:/java-tron/output-directory
command:
- -jvm
- "{-Xmx5g -Xms4g -XX:+UseConcMarkSweepGC}" # Using environment variable for JVM arguments
- "{-Xmx5g -Xms4g}" # Using environment variable for JVM arguments
- -c
- /java-tron/conf/nile_net_config.conf
Loading