Skip to content

Commit

Permalink
🎨 Small clean-up, and add JVM 17 arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ally Mitchell committed May 13, 2023
1 parent d5467ad commit 11ed8a5
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ COPY --from=install /opt/server/node_modules ./node_modules
COPY --from=install /opt/server/package*.json .
COPY --from=build /opt/server/dist ./dist

CMD ["node", "dist/index.js"]
CMD ["node", "dist/main.js"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches: [ 'develop', 'production' ]

env:
CACHE_REV: "1"

jobs:
build-jdk17:
runs-on: ubuntu-22.04
Expand All @@ -12,6 +15,14 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
${{ github.workspace}}/dist/
${{ github.workspace}}/node_modules/
key: "${{ runner.os }}-build-${{ env.CACHE_REV }}-${{ hashFiles('**/*node_modules*') }}"
restore-keys: |
${{ runner.os }}-build-${{ env.CACHE_REV }}-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Image Registry
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "server-operator",
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"build-and-start": "tsc && node dist/index.js",
"start": "node dist/main.js",
"build-and-start": "tsc && node dist/main.js",
"format": "prettier --write \"src/**/*.ts\""
},
"version": "1.0.0",
Expand All @@ -20,4 +20,4 @@
"prettier": "^2.7.1",
"typescript": "^4.7.4"
}
}
}
73 changes: 45 additions & 28 deletions src/helper/jvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,55 @@ export const getDefaultJVMArguments = (
['Dfml.ignorePatchDiscrepancies']: true,
['Dfml.ignoreInvalidMinecraftCertificates']: true,
['Dterminal.ansi']: true,
['Dterminal.jline']: false
['Dterminal.jline']: false,
['XX:+UnlockExperimentalVMOptions']: ''
}

let versionSpecificArguments = {}

if (javaVersion && javaVersion === 8) {
versionSpecificArguments = {
Xmn128M: '',
['XX:+DisableExplicitGC']: '',
['XX:+UseConcMarkSweepGC']: '',
['XX:+UseParNewGC']: '',
['XX:+UseNUMA']: '',
['XX:+CMSParallelRemarkEnabled']: '',
['XX:MaxTenuringThreshold']: 15,
['XX:MaxGCPauseMillis']: 30,
['XX:GCPauseIntervalMillis']: 150,
['XX:+UseAdaptiveGCBoundary']: '',
['XX:-UseGCOverheadLimit']: '',
['XX:+UseBiasedLocking']: '',
['XX:SurvivorRatio']: 8,
['XX:TargetSurvivorRatio']: 90,
['XX:+UseFastAccessorMethods']: '',
['XX:+UseCompressedOops']: '',
['XX:+OptimizeStringConcat']: '',
['XX:+AggressiveOpts']: '',
['XX:ReservedCodeCacheSize']: '2048m',
['XX:+UseCodeCacheFlushing']: '',
['XX:SoftRefLRUPolicyMSPerMB']: 10000,
['XX:ParallelGCThreads']: 10,
['XX:HeapDumpPath']:
'MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump',
}
switch (javaVersion) {
case 8:
versionSpecificArguments = {
Xmn128M: '',
['XX:+DisableExplicitGC']: '',
['XX:+UseConcMarkSweepGC']: '',
['XX:+UseParNewGC']: '',
['XX:+UseNUMA']: '',
['XX:+CMSParallelRemarkEnabled']: '',
['XX:MaxTenuringThreshold']: 15,
['XX:MaxGCPauseMillis']: 30,
['XX:GCPauseIntervalMillis']: 150,
['XX:+UseAdaptiveGCBoundary']: '',
['XX:-UseGCOverheadLimit']: '',
['XX:+UseBiasedLocking']: '',
['XX:SurvivorRatio']: 8,
['XX:TargetSurvivorRatio']: 90,
['XX:+UseFastAccessorMethods']: '',
['XX:+UseCompressedOops']: '',
['XX:+OptimizeStringConcat']: '',
['XX:+AggressiveOpts']: '',
['XX:ReservedCodeCacheSize']: '2048m',
['XX:+UseCodeCacheFlushing']: '',
['XX:SoftRefLRUPolicyMSPerMB']: 10000,
['XX:ParallelGCThreads']: 10,
['XX:HeapDumpPath']:
'MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump',
}
break;
case 17:
versionSpecificArguments = {
Xmn128M: '',
'XX:+UseZGC': '',
'XX:+ParallelRefProcEnabled': '',
'XX:MaxGCPauseMillis': 200,
'XX:+DisableExplicitGC': '',
'XX:+AlwaysPreTouch': '',
'XX:InitiatingHeapOccupancyPercent': 15,
'XX:SurvivorRatio': 32,
'XX:+PerfDisableSharedMem': '',
'XX:MaxTenuringThreshold': ''
}
break;
}

return {
Expand Down
File renamed without changes.

0 comments on commit 11ed8a5

Please sign in to comment.