[improvement](build) Tune short-lived FE unit test JVMs (#69014)

Problem Summary: fe-core starts a fresh JVM for each test class. Default
CPU ergonomics and higher-tier compilation add substantial work to
short-lived forks. Pass ActiveProcessorCount=2 and TieredStopAtLevel=1
from run-fe-ut.sh to the fe-core Surefire JVMs. Allow FE_UT_JAVA_OPTS to
override the defaults, including an empty value to restore the baseline.

Preserve FE_UT_PARALLEL, per-class process isolation and JaCoCo argLine.
Direct Maven invocations retain their existing defaults. A local
64-class sample with 8 forks reduced mean CPU time from 1679.84s to
633.31s (62.3%) and Surefire wall time from 139.82s to 125.58s (10.2%)
across two runs. These are sample measurements, not a full FE UT or CI
speedup guarantee.
This commit is contained in:
py023 authored and GitHub committed 2026-10-15 10:38:03 +08:00
1 parent 82d44b4cc1
commit e4e4af392f
2 files changed
+13 -5

No files matched your search

+3 -1
View File
@@ -34,6 +34,8 @@ under the License.
<doris.home>${basedir}/../../</doris.home>
<doris.thirdparty>${basedir}/../../thirdparty</doris.thirdparty>
<fe_ut_parallel>1</fe_ut_parallel>
<!-- Set by run-fe-ut.sh; direct Maven invocations keep the JVM defaults. -->
<fe.ut.jvm.args></fe.ut.jvm.args>
<!--
The LINEAGE plugin API version, declared exactly once. Filtered into this module's
@@ -1038,7 +1040,7 @@ under the License.
<reuseForks>false</reuseForks>
<useFile>false</useFile>
<argLine>
-Xmx1024m --add-reads=org.apache.arrow.flight.core=ALL-UNNAMED --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED @{argLine}
-Xmx1024m ${fe.ut.jvm.args} --add-reads=org.apache.arrow.flight.core=ALL-UNNAMED --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED @{argLine}
</argLine>
</configuration>
</plugin>
+10 -4
View File
@@ -136,6 +136,8 @@ Usage: $0 <options>
Environment variables:
EXTRA_FE_MODULES Optional FE feature modules in feature=module_path format, separated by commas.
FE_UT_JAVA_OPTS Forked fe-core JVM options (set to empty for a baseline run).
Default: -XX:ActiveProcessorCount=2 -XX:TieredStopAtLevel=1
Eg.
$0 build and run ut
@@ -258,6 +260,10 @@ if [[ -z "${FE_UT_PARALLEL}" ]]; then
fi
echo "Unit test parallel is: ${FE_UT_PARALLEL}"
# Reduce GC/compiler overhead in short-lived test JVMs; an explicit empty value restores defaults.
FE_UT_JAVA_OPTS="${FE_UT_JAVA_OPTS--XX:ActiveProcessorCount=2 -XX:TieredStopAtLevel=1}"
echo "FE UT fork JVM options: ${FE_UT_JAVA_OPTS}"
if [[ "${RUN}" -eq 1 ]]; then
echo "Run the specified class: $1"
# eg:
@@ -265,18 +271,18 @@ if [[ "${RUN}" -eq 1 ]]; then
# sh run-fe-ut.sh --run org.apache.doris.utframe.DemoTest#testCreateDbAndTable+test2
if [[ "${COVERAGE}" -eq 1 ]]; then
"${MVN_CMD}" -Pcoverage test jacoco:report -pl "${MVN_MODULES}" -am -DfailIfNoTests=false -Dtest="$1"
"${MVN_CMD}" "-Dfe.ut.jvm.args=${FE_UT_JAVA_OPTS}" -Pcoverage test jacoco:report -pl "${MVN_MODULES}" -am -DfailIfNoTests=false -Dtest="$1"
else
"${MVN_CMD}" test -pl "${MVN_MODULES}" -am -Dcheckstyle.skip=true -DfailIfNoTests=false \
"${MVN_CMD}" "-Dfe.ut.jvm.args=${FE_UT_JAVA_OPTS}" test -pl "${MVN_MODULES}" -am -Dcheckstyle.skip=true -DfailIfNoTests=false \
-Dmaven.build.cache.enabled=false -Dtest="$1"
fi
else
echo "Run Frontend UT"
if [[ "${COVERAGE}" -eq 1 ]]; then
"${MVN_CMD}" -Pcoverage test jacoco:report -pl "${MVN_MODULES}" -am -DfailIfNoTests=false \
"${MVN_CMD}" "-Dfe.ut.jvm.args=${FE_UT_JAVA_OPTS}" -Pcoverage test jacoco:report -pl "${MVN_MODULES}" -am -DfailIfNoTests=false \
-Dmaven.test.failure.ignore=true
else
"${MVN_CMD}" test -pl "${MVN_MODULES}" -am -Dcheckstyle.skip=true -DfailIfNoTests=false \
"${MVN_CMD}" "-Dfe.ut.jvm.args=${FE_UT_JAVA_OPTS}" test -pl "${MVN_MODULES}" -am -Dcheckstyle.skip=true -DfailIfNoTests=false \
-Dmaven.build.cache.enabled=false
fi