update
This commit is contained in:
parent
2a6abd8103
commit
1c27da9918
@ -1,4 +1,2 @@
|
||||
MC_DIR=/root/mc/renyuan/Server # 活动目录(主机上的路径)
|
||||
MAX_MEMORY=8G # 最大内存
|
||||
MIN_MEMORY=4G # 最小内存
|
||||
JAR_FILE=./Purpur-1.20.1.jar # jar 文件的路径
|
||||
|
@ -1,20 +1,22 @@
|
||||
services:
|
||||
minecraft:
|
||||
image: openjdk:17
|
||||
image: openjdk:17-jre # 使用 JRE 版本的镜像
|
||||
container_name: minecraft-server
|
||||
working_dir: /mc-server
|
||||
environment:
|
||||
- MAX_MEMORY=${MAX_MEMORY}
|
||||
- MIN_MEMORY=${MIN_MEMORY}
|
||||
- MAX_MEMORY=7G # 设置最大内存为 10GB
|
||||
- MIN_MEMORY=7G # 将最小内存也设置为 10GB,确保不会低于该值
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${MC_DIR}:/mc-server
|
||||
command: >
|
||||
java -Xms${MAX_MEMORY} -Xmx${MAX_MEMORY} -XX:MaxRAM=${MAX_MEMORY}
|
||||
java -Xms${MIN_MEMORY} -Xmx${MAX_MEMORY} -XX:MaxRAM=8G
|
||||
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m
|
||||
-XX:MaxDirectMemorySize=2G
|
||||
-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200
|
||||
-XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC
|
||||
-XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40
|
||||
-XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5
|
||||
-XX:G1HeapRegionSize=8M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5
|
||||
-XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15
|
||||
-XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5
|
||||
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1
|
||||
@ -25,7 +27,7 @@ services:
|
||||
stdin_open: true
|
||||
tty: true
|
||||
restart: always
|
||||
mem_limit: 10G
|
||||
memswap_limit: 10G # 禁止使用 swap
|
||||
oom_score_adj: -1000
|
||||
# mem_limit: 10G # 设置容器的内存限制为 10GB
|
||||
# memswap_limit: 10G # 禁止使用 swap,并确保总内存不超过 10GB
|
||||
# oom_score_adj: -1000
|
||||
stop_grace_period: 120s # 设置关闭宽限期为 120 秒
|
||||
|
Loading…
Reference in New Issue
Block a user