Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
81301469
Commit
81301469
authored
Jun 07, 2016
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve startup performance
parent
ccc4b1bb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
30 deletions
+45
-30
startup.sh
apollo-adminservice/src/main/scripts/startup.sh
+15
-10
startup.sh
apollo-configservice/src/main/scripts/startup.sh
+15
-10
startup.sh
apollo-portal/src/main/scripts/startup.sh
+15
-10
No files found.
apollo-adminservice/src/main/scripts/startup.sh
View file @
81301469
#!/bin/bash
SERVICE_NAME
=
apollo-adminservice
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
LOG_DIR
=
/opt/logs/100003172
SERVER_PORT
=
8090
export
JAVA_OPTS
=
"-server -Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1024m -XX:MaxNewSize=1024m -XX:SurvivorRatio=22 -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8"
export
JAVA_OPTS
=
"
$JAVA_OPTS
-Xloggc:/opt/logs/100003172/heap_trace.txt -XX:HeapDumpPath=/opt/logs/100003172/HeapDumpOnOutOfMemoryError/"
export
JAVA_OPTS
=
"-server -Xms2560m -Xmx2560m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1024m -XX:MaxNewSize=1024m -XX:SurvivorRatio=22"
SERVER_PORT
=
8090
########### The following is the same for configservice, adminservice, portal ###########
export
JAVA_OPTS
=
"
$JAVA_OPTS
-XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Xloggc:
$LOG_DIR
/heap_trace.txt -XX:HeapDumpPath=
$LOG_DIR
/HeapDumpOnOutOfMemoryError/ -Djava.security.egd=file:/dev/./urandom"
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
STARTUP_LOG
=
$LOG_DIR
"/startup.log"
########### The following is the same for configservice, adminservice, portal ###########
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
export
JAVA_HOME
=
/usr/java/latest/
fi
...
...
@@ -40,6 +43,8 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
rm
-rf
$SERVICE_NAME
".jar"
fi
printf
"
$(
date
)
==== Starting ====
\n
"
>
$STARTUP_LOG
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
./
$SERVICE_NAME
".jar"
start
...
...
@@ -48,7 +53,7 @@ rc=$?;
if
[[
$rc
!=
0
]]
;
then
echo
"
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
>>
$STARTUP_LOG
exit
$rc
;
fi
...
...
@@ -56,10 +61,10 @@ declare -i counter=0
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
total_time
=
0
printf
"Waiting for server startup"
printf
"Waiting for server startup"
>>
$STARTUP_LOG
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
--silent
--connect-timeout
1
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
do
printf
"."
printf
"."
>>
$STARTUP_LOG
counter+
=
1
sleep
5
done
...
...
@@ -68,10 +73,10 @@ total_time=counter*5
if
[[
((
counter
-ge
max_counter
))
]]
;
then
printf
"
\n
Server failed to start in
$total_time
seconds!
\n
"
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
exit
1
;
fi
printf
"
\n
Server started in
$total_time
seconds!
\n
"
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
exit
0
;
apollo-configservice/src/main/scripts/startup.sh
View file @
81301469
#!/bin/bash
SERVICE_NAME
=
apollo-configservice
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
LOG_DIR
=
/opt/logs/100003171
SERVER_PORT
=
8080
export
JAVA_OPTS
=
"-server -Xms5632m -Xmx5632m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=2560m -XX:MaxNewSize=2560m -XX:SurvivorRatio=22 -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8"
export
JAVA_OPTS
=
"
$JAVA_OPTS
-Xloggc:/opt/logs/100003171/heap_trace.txt -XX:HeapDumpPath=/opt/logs/100003171/HeapDumpOnOutOfMemoryError/"
export
JAVA_OPTS
=
"-server -Xms5632m -Xmx5632m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=2560m -XX:MaxNewSize=2560m -XX:SurvivorRatio=22"
SERVER_PORT
=
8080
########### The following is the same for configservice, adminservice, portal ###########
export
JAVA_OPTS
=
"
$JAVA_OPTS
-XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Xloggc:
$LOG_DIR
/heap_trace.txt -XX:HeapDumpPath=
$LOG_DIR
/HeapDumpOnOutOfMemoryError/ -Djava.security.egd=file:/dev/./urandom"
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
STARTUP_LOG
=
$LOG_DIR
"/startup.log"
########### The following is the same for configservice, adminservice, portal ###########
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
export
JAVA_HOME
=
/usr/java/latest/
fi
...
...
@@ -40,6 +43,8 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
rm
-rf
$SERVICE_NAME
".jar"
fi
printf
"
$(
date
)
==== Starting ====
\n
"
>
$STARTUP_LOG
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
./
$SERVICE_NAME
".jar"
start
...
...
@@ -48,7 +53,7 @@ rc=$?;
if
[[
$rc
!=
0
]]
;
then
echo
"
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
>>
$STARTUP_LOG
exit
$rc
;
fi
...
...
@@ -56,10 +61,10 @@ declare -i counter=0
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
total_time
=
0
printf
"Waiting for server startup"
printf
"Waiting for server startup"
>>
$STARTUP_LOG
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
--silent
--connect-timeout
1
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
do
printf
"."
printf
"."
>>
$STARTUP_LOG
counter+
=
1
sleep
5
done
...
...
@@ -68,10 +73,10 @@ total_time=counter*5
if
[[
((
counter
-ge
max_counter
))
]]
;
then
printf
"
\n
Server failed to start in
$total_time
seconds!
\n
"
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
exit
1
;
fi
printf
"
\n
Server started in
$total_time
seconds!
\n
"
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
exit
0
;
apollo-portal/src/main/scripts/startup.sh
View file @
81301469
#!/bin/bash
SERVICE_NAME
=
apollo-portal
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
LOG_DIR
=
/opt/logs/100003173
SERVER_PORT
=
8080
export
JAVA_OPTS
=
"-server -Xms4096m -Xmx4096m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=22 -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8"
export
JAVA_OPTS
=
"
$JAVA_OPTS
-Xloggc:/opt/logs/100003173/heap_trace.txt -XX:HeapDumpPath=/opt/logs/100003173/HeapDumpOnOutOfMemoryError/"
export
JAVA_OPTS
=
"-server -Xms4096m -Xmx4096m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=1536m -XX:MaxNewSize=1536m -XX:SurvivorRatio=22"
SERVER_PORT
=
8080
########### The following is the same for configservice, adminservice, portal ###########
export
JAVA_OPTS
=
"
$JAVA_OPTS
-XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:-ReduceInitialCardMarks -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Xloggc:
$LOG_DIR
/heap_trace.txt -XX:HeapDumpPath=
$LOG_DIR
/HeapDumpOnOutOfMemoryError/ -Djava.security.egd=file:/dev/./urandom"
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
STARTUP_LOG
=
$LOG_DIR
"/startup.log"
########### The following is the same for configservice, adminservice, portal ###########
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
export
JAVA_HOME
=
/usr/java/latest/
fi
...
...
@@ -40,6 +43,8 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
rm
-rf
$SERVICE_NAME
".jar"
fi
printf
"
$(
date
)
==== Starting ====
\n
"
>
$STARTUP_LOG
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
./
$SERVICE_NAME
".jar"
start
...
...
@@ -48,7 +53,7 @@ rc=$?;
if
[[
$rc
!=
0
]]
;
then
echo
"
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
>>
$STARTUP_LOG
exit
$rc
;
fi
...
...
@@ -56,10 +61,10 @@ declare -i counter=0
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
total_time
=
0
printf
"Waiting for server startup"
printf
"Waiting for server startup"
>>
$STARTUP_LOG
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
--silent
--connect-timeout
1
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
do
printf
"."
printf
"."
>>
$STARTUP_LOG
counter+
=
1
sleep
5
done
...
...
@@ -68,10 +73,10 @@ total_time=counter*5
if
[[
((
counter
-ge
max_counter
))
]]
;
then
printf
"
\n
Server failed to start in
$total_time
seconds!
\n
"
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
exit
1
;
fi
printf
"
\n
Server started in
$total_time
seconds!
\n
"
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
exit
0
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment