Skip to content

Commit

Permalink
Optimize startup.cmd, fix #3269 (#3270)
Browse files Browse the repository at this point in the history
* Fix #3269

* Fix #3269
  • Loading branch information
lidaoyang authored Jul 8, 2020
1 parent c34abf3 commit 144c181
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions distribution/bin/startup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ set SERVER=nacos-server
set MODE_INDEX=-1
set FUNCTION_MODE_INDEX=-1
set SERVER_INDEX=-1
set EMBEDDED_STORAGE_INDEX=-1
set EMBEDDED_STORAGE=""


set i=0
for %%a in (%*) do (
if "%%a" == "-m" ( set /a MODE_INDEX=!i!+1 )
if "%%a" == "-f" ( set /a FUNCTION_MODE_INDEX=!i!+1 )
if "%%a" == "-s" ( set /a SERVER_INDEX=!i!+1 )
if "%%a" == "-p" ( set /a EMBEDDED_STORAGE_INDEX=!i!+1 )
set /a i+=1
)

Expand All @@ -45,13 +48,17 @@ for %%a in (%*) do (
if %MODE_INDEX% == !i! ( set MODE="%%a" )
if %FUNCTION_MODE_INDEX% == !i! ( set FUNCTION_MODE="%%a" )
if %SERVER_INDEX% == !i! (set SERVER="%%a")
if %EMBEDDED_STORAGE_INDEX% == !i! (set EMBEDDED_STORAGE="%%a")
set /a i+=1
)

if %MODE% == "standalone" (
set "JAVA_OPT=%JAVA_OPT% -Xms512m -Xmx512m -Xmn256m"
set "JAVA_OPT=%JAVA_OPT% -Dnacos.standalone=true"
) else (
if %EMBEDDED_STORAGE% == "embedded" (
set "JAVA_OPT=%JAVA_OPT% -DembeddedStorage=true"
)
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof"
set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages"
Expand Down

0 comments on commit 144c181

Please sign in to comment.