Skip to content

Commit ee4ce4e

Browse files
authored
Merge pull request #601 from jdmcclur/vNext-perf4
Add call to OpenAPI endpoint
2 parents 2367018 + 16a01ce commit ee4ce4e

File tree

5 files changed

+72
-8
lines changed

5 files changed

+72
-8
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ This feature can be controlled via the following variables:
141141
* `WARM_ENDPOINT_URL` (enviornment variable)
142142
* Description: The URL to access during SCC population if WARM_ENDPOINT is true.
143143
* Default: `"localhost:9080/"`.
144+
* `WARM_OPENAPI_ENDPOINT` (environment variable)
145+
* Description: (24.0.0.4+) If `"true"`, curl will be used to access the WARM_OPENAPI_ENDPOINT_URL (see below) during the population of the SCC. This will increase the amount of information in the SCC and improve first request time in subsequent starts of the image.
146+
* Default: `"true"`
147+
* `WARM_OPENAPI_ENDPOINT_URL` (enviornment variable)
148+
* Description: (24.0.0.4+) The URL to access during SCC population if WARM_OPENAPI_ENDPOINT is true.
149+
* Default: `"localhost:9080/openapi"`
144150

145151
## Logging
146152

ga/24.0.0.4/kernel/helpers/build/configure.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ function main() {
185185
if [ ! "$WARM_ENDPOINT_URL" = "" ]; then
186186
cmd+=" -u $WARM_ENDPOINT_URL"
187187
fi
188+
if [ "$WARM_OPENAPI_ENDPOINT" = "false" ]; then
189+
cmd+=" -l"
190+
fi
191+
if [ ! "$WARM_OPENAPI_ENDPOINT_URL" = "" ]; then
192+
cmd+=" -o $WARM_OPENAPI_ENDPOINT_URL"
193+
fi
188194
eval $cmd
189195
fi
190196
}

ga/24.0.0.4/kernel/helpers/build/populate_scc.sh

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ ITERATIONS=2 # Number of iterations to run to populate it.
2626
TRIM_SCC=yes # Trim the SCC to eliminate any wasted space.
2727
WARM_ENDPOINT=true
2828
WARM_ENDPOINT_URL=localhost:9080/
29+
WARM_OPENAPI_ENDPOINT=true
30+
WARM_OPENAPI_ENDPOINT_URL=localhost:9080/openapi
2931

3032
# If this directory exists and has at least ug=rwx permissions, assume the base image includes an SCC called 'openj9_system_scc' and build on it.
3133
# If not, build on our own SCC.
@@ -51,7 +53,7 @@ CREATE_LAYER="$OPENJ9_JAVA_OPTIONS,createLayer,groupAccess"
5153
DESTROY_LAYER="$OPENJ9_JAVA_OPTIONS,destroy"
5254
PRINT_LAYER_STATS="$OPENJ9_JAVA_OPTIONS,printTopLayerStats"
5355

54-
while getopts ":i:s:u:tdhwc" OPT
56+
while getopts ":i:s:u:o:tdhwcml" OPT
5557
do
5658
case "$OPT" in
5759
i)
@@ -76,15 +78,28 @@ do
7678
u)
7779
WARM_ENDPOINT_URL="${OPTARG}"
7880
;;
81+
m)
82+
WARM_OPENAPI_ENDPOINT=true
83+
;;
84+
l)
85+
WARM_OPENAPI_ENDPOINT=false
86+
;;
87+
o)
88+
WARM_OPENAPI_ENDPOINT_URL="${OPTARG}"
89+
;;
7990
h)
8091
echo \
81-
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-u url]
92+
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-c] [-u url] [-m] [-l] [-o url]
8293
-i <iterations> Number of iterations to run to populate the SCC. (Default: $ITERATIONS)
8394
-s <size> Size of the SCC in megabytes (m suffix required). (Default: $SCC_SIZE)
8495
-t Trim the SCC to eliminate most of the free space, if any.
8596
-d Don't trim the SCC.
8697
-w Use curl to warm an endpoint during SCC creation. (Default: $WARM_ENDPOINT)
98+
-c Do not warm an endpoint during SCC creation.
8799
-u The URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_URL)
100+
-m Use curl to warm the openapi endpoint during SCC creation. (Default: $WARM_OPENAPI_ENDPOINT)
101+
-l Do not warm the openapi endpoint during SCC creation.
102+
-o The Open API URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_OPENAPI_URL)
88103
89104
Trimming enabled=$TRIM_SCC"
90105
exit 1
@@ -115,7 +130,11 @@ then
115130

116131
if [ ${WARM_ENDPOINT} == true ]
117132
then
118-
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
133+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "${WARM_ENDPOINT_URL} call failed, continuing"
134+
fi
135+
if [ ${WARM_OPENAPI_ENDPOINT} == true ]
136+
then
137+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_OPENAPI_ENDPOINT_URL} 2>&1 || echo "${WARM_OPENAPI_ENDPOINT_URL} call failed, continuing"
119138
fi
120139

121140
/opt/ibm/wlp/bin/server stop
@@ -146,7 +165,11 @@ do
146165

147166
if [ ${WARM_ENDPOINT} == true ]
148167
then
149-
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
168+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "${WARM_ENDPOINT_URL} call failed, continuing"
169+
fi
170+
if [ ${WARM_OPENAPI_ENDPOINT} == true ]
171+
then
172+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_OPENAPI_ENDPOINT_URL} 2>&1 || echo "${WARM_OPENAPI_ENDPOINT_URL} call failed, continuing"
150173
fi
151174

152175
/opt/ibm/wlp/bin/server stop

ga/latest/kernel/helpers/build/configure.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ function main() {
185185
if [ ! "$WARM_ENDPOINT_URL" = "" ]; then
186186
cmd+=" -u $WARM_ENDPOINT_URL"
187187
fi
188+
if [ "$WARM_OPENAPI_ENDPOINT" = "false" ]; then
189+
cmd+=" -l"
190+
fi
191+
if [ ! "$WARM_OPENAPI_ENDPOINT_URL" = "" ]; then
192+
cmd+=" -o $WARM_OPENAPI_ENDPOINT_URL"
193+
fi
188194
eval $cmd
189195
fi
190196
}

ga/latest/kernel/helpers/build/populate_scc.sh

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ ITERATIONS=2 # Number of iterations to run to populate it.
2626
TRIM_SCC=yes # Trim the SCC to eliminate any wasted space.
2727
WARM_ENDPOINT=true
2828
WARM_ENDPOINT_URL=localhost:9080/
29+
WARM_OPENAPI_ENDPOINT=true
30+
WARM_OPENAPI_ENDPOINT_URL=localhost:9080/openapi
2931

3032
# If this directory exists and has at least ug=rwx permissions, assume the base image includes an SCC called 'openj9_system_scc' and build on it.
3133
# If not, build on our own SCC.
@@ -51,7 +53,7 @@ CREATE_LAYER="$OPENJ9_JAVA_OPTIONS,createLayer,groupAccess"
5153
DESTROY_LAYER="$OPENJ9_JAVA_OPTIONS,destroy"
5254
PRINT_LAYER_STATS="$OPENJ9_JAVA_OPTIONS,printTopLayerStats"
5355

54-
while getopts ":i:s:u:tdhwc" OPT
56+
while getopts ":i:s:u:o:tdhwcml" OPT
5557
do
5658
case "$OPT" in
5759
i)
@@ -76,15 +78,28 @@ do
7678
u)
7779
WARM_ENDPOINT_URL="${OPTARG}"
7880
;;
81+
m)
82+
WARM_OPENAPI_ENDPOINT=true
83+
;;
84+
l)
85+
WARM_OPENAPI_ENDPOINT=false
86+
;;
87+
o)
88+
WARM_OPENAPI_ENDPOINT_URL="${OPTARG}"
89+
;;
7990
h)
8091
echo \
81-
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-u url]
92+
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-c] [-u url] [-m] [-l] [-o url]
8293
-i <iterations> Number of iterations to run to populate the SCC. (Default: $ITERATIONS)
8394
-s <size> Size of the SCC in megabytes (m suffix required). (Default: $SCC_SIZE)
8495
-t Trim the SCC to eliminate most of the free space, if any.
8596
-d Don't trim the SCC.
8697
-w Use curl to warm an endpoint during SCC creation. (Default: $WARM_ENDPOINT)
98+
-c Do not warm an endpoint during SCC creation.
8799
-u The URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_URL)
100+
-m Use curl to warm the openapi endpoint during SCC creation. (Default: $WARM_OPENAPI_ENDPOINT)
101+
-l Do not warm the openapi endpoint during SCC creation.
102+
-o The Open API URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_OPENAPI_URL)
88103
89104
Trimming enabled=$TRIM_SCC"
90105
exit 1
@@ -115,7 +130,11 @@ then
115130

116131
if [ ${WARM_ENDPOINT} == true ]
117132
then
118-
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
133+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "${WARM_ENDPOINT_URL} call failed, continuing"
134+
fi
135+
if [ ${WARM_OPENAPI_ENDPOINT} == true ]
136+
then
137+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_OPENAPI_ENDPOINT_URL} 2>&1 || echo "${WARM_OPENAPI_ENDPOINT_URL} call failed, continuing"
119138
fi
120139

121140
/opt/ibm/wlp/bin/server stop
@@ -146,7 +165,11 @@ do
146165

147166
if [ ${WARM_ENDPOINT} == true ]
148167
then
149-
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
168+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "${WARM_ENDPOINT_URL} call failed, continuing"
169+
fi
170+
if [ ${WARM_OPENAPI_ENDPOINT} == true ]
171+
then
172+
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_OPENAPI_ENDPOINT_URL} 2>&1 || echo "${WARM_OPENAPI_ENDPOINT_URL} call failed, continuing"
150173
fi
151174

152175
/opt/ibm/wlp/bin/server stop

0 commit comments

Comments
 (0)