refactor(性能测试): 资源池增加配置gc和heap的选项
This commit is contained in:
parent
e2c0bedb8d
commit
072792eb8b
|
@ -22,5 +22,9 @@ public class TestResourcePool implements Serializable {
|
|||
|
||||
private String image;
|
||||
|
||||
private String heap;
|
||||
|
||||
private String gcAlgo;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -643,6 +643,146 @@ public class TestResourcePoolExample {
|
|||
addCriterion("image not between", value1, value2, "image");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapIsNull() {
|
||||
addCriterion("`heap` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapIsNotNull() {
|
||||
addCriterion("`heap` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapEqualTo(String value) {
|
||||
addCriterion("`heap` =", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapNotEqualTo(String value) {
|
||||
addCriterion("`heap` <>", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapGreaterThan(String value) {
|
||||
addCriterion("`heap` >", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`heap` >=", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapLessThan(String value) {
|
||||
addCriterion("`heap` <", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapLessThanOrEqualTo(String value) {
|
||||
addCriterion("`heap` <=", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapLike(String value) {
|
||||
addCriterion("`heap` like", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapNotLike(String value) {
|
||||
addCriterion("`heap` not like", value, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapIn(List<String> values) {
|
||||
addCriterion("`heap` in", values, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapNotIn(List<String> values) {
|
||||
addCriterion("`heap` not in", values, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapBetween(String value1, String value2) {
|
||||
addCriterion("`heap` between", value1, value2, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andHeapNotBetween(String value1, String value2) {
|
||||
addCriterion("`heap` not between", value1, value2, "heap");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoIsNull() {
|
||||
addCriterion("gc_algo is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoIsNotNull() {
|
||||
addCriterion("gc_algo is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoEqualTo(String value) {
|
||||
addCriterion("gc_algo =", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoNotEqualTo(String value) {
|
||||
addCriterion("gc_algo <>", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoGreaterThan(String value) {
|
||||
addCriterion("gc_algo >", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("gc_algo >=", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoLessThan(String value) {
|
||||
addCriterion("gc_algo <", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoLessThanOrEqualTo(String value) {
|
||||
addCriterion("gc_algo <=", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoLike(String value) {
|
||||
addCriterion("gc_algo like", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoNotLike(String value) {
|
||||
addCriterion("gc_algo not like", value, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoIn(List<String> values) {
|
||||
addCriterion("gc_algo in", values, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoNotIn(List<String> values) {
|
||||
addCriterion("gc_algo not in", values, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoBetween(String value1, String value2) {
|
||||
addCriterion("gc_algo between", value1, value2, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGcAlgoNotBetween(String value1, String value2) {
|
||||
addCriterion("gc_algo not between", value1, value2, "gcAlgo");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="image" jdbcType="VARCHAR" property="image" />
|
||||
<result column="heap" jdbcType="VARCHAR" property="heap" />
|
||||
<result column="gc_algo" jdbcType="VARCHAR" property="gcAlgo" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -70,7 +72,8 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, `type`, description, `status`, create_time, update_time, image
|
||||
id, `name`, `type`, description, `status`, create_time, update_time, image, `heap`,
|
||||
gc_algo
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultMap="BaseResultMap">
|
||||
select
|
||||
|
@ -105,10 +108,12 @@
|
|||
<insert id="insert" parameterType="io.metersphere.base.domain.TestResourcePool">
|
||||
insert into test_resource_pool (id, `name`, `type`,
|
||||
description, `status`, create_time,
|
||||
update_time, image)
|
||||
update_time, image, `heap`,
|
||||
gc_algo)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=BIGINT}, #{image,jdbcType=VARCHAR})
|
||||
#{updateTime,jdbcType=BIGINT}, #{image,jdbcType=VARCHAR}, #{heap,jdbcType=VARCHAR},
|
||||
#{gcAlgo,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResourcePool">
|
||||
insert into test_resource_pool
|
||||
|
@ -137,6 +142,12 @@
|
|||
<if test="image != null">
|
||||
image,
|
||||
</if>
|
||||
<if test="heap != null">
|
||||
`heap`,
|
||||
</if>
|
||||
<if test="gcAlgo != null">
|
||||
gc_algo,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -163,6 +174,12 @@
|
|||
<if test="image != null">
|
||||
#{image,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="heap != null">
|
||||
#{heap,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="gcAlgo != null">
|
||||
#{gcAlgo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultType="java.lang.Long">
|
||||
|
@ -198,6 +215,12 @@
|
|||
<if test="record.image != null">
|
||||
image = #{record.image,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.heap != null">
|
||||
`heap` = #{record.heap,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.gcAlgo != null">
|
||||
gc_algo = #{record.gcAlgo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -212,7 +235,9 @@
|
|||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
image = #{record.image,jdbcType=VARCHAR}
|
||||
image = #{record.image,jdbcType=VARCHAR},
|
||||
`heap` = #{record.heap,jdbcType=VARCHAR},
|
||||
gc_algo = #{record.gcAlgo,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -241,6 +266,12 @@
|
|||
<if test="image != null">
|
||||
image = #{image,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="heap != null">
|
||||
`heap` = #{heap,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="gcAlgo != null">
|
||||
gc_algo = #{gcAlgo,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -252,7 +283,9 @@
|
|||
`status` = #{status,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
image = #{image,jdbcType=VARCHAR}
|
||||
image = #{image,jdbcType=VARCHAR},
|
||||
`heap` = #{heap,jdbcType=VARCHAR},
|
||||
gc_algo = #{gcAlgo,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -24,6 +24,8 @@ import java.util.UUID;
|
|||
|
||||
public abstract class AbstractEngine implements Engine {
|
||||
protected String JMETER_IMAGE;
|
||||
protected String HEAP;
|
||||
protected String GC_ALGO;
|
||||
private Long startTime;
|
||||
private String reportId;
|
||||
protected LoadTestWithBLOBs loadTest;
|
||||
|
@ -38,6 +40,8 @@ public abstract class AbstractEngine implements Engine {
|
|||
testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
|
||||
testResourceService = CommonBeanFactory.getBean(TestResourceService.class);
|
||||
JMETER_IMAGE = CommonBeanFactory.getBean(JmeterProperties.class).getImage();
|
||||
HEAP = CommonBeanFactory.getBean(JmeterProperties.class).getHeap();
|
||||
GC_ALGO = CommonBeanFactory.getBean(JmeterProperties.class).getGcAlgo();
|
||||
this.startTime = System.currentTimeMillis();
|
||||
this.reportId = UUID.randomUUID().toString();
|
||||
}
|
||||
|
@ -71,6 +75,16 @@ public abstract class AbstractEngine implements Engine {
|
|||
if (StringUtils.isNotEmpty(image)) {
|
||||
JMETER_IMAGE = image;
|
||||
}
|
||||
// heap
|
||||
String heap = resourcePool.getHeap();
|
||||
if (StringUtils.isNotEmpty(heap)) {
|
||||
HEAP = heap;
|
||||
}
|
||||
// gc_algo
|
||||
String gcAlgo = resourcePool.getGcAlgo();
|
||||
if (StringUtils.isNotEmpty(gcAlgo)) {
|
||||
GC_ALGO = gcAlgo;
|
||||
}
|
||||
this.resourceList = testResourceService.getResourcesByPoolId(resourcePool.getId());
|
||||
if (CollectionUtils.isEmpty(this.resourceList)) {
|
||||
MSException.throwException("Test Resource is empty");
|
||||
|
|
|
@ -96,8 +96,8 @@ public class DockerTestEngine extends AbstractEngine {
|
|||
env.put("LOG_TOPIC", kafkaProperties.getLog().getTopic());
|
||||
env.put("RESOURCE_ID", resource.getId());
|
||||
env.put("THREAD_NUM", "0");// 传入0表示不用修改线程数
|
||||
env.put("HEAP", jmeterProperties.getHeap());
|
||||
env.put("GC_ALGO", jmeterProperties.getGcAlgo());
|
||||
env.put("HEAP", HEAP);
|
||||
env.put("GC_ALGO", GC_ALGO);
|
||||
|
||||
|
||||
StartTestRequest startTestRequest = new StartTestRequest();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4283ddbe7d60aa83ec94ee770fc93485a0c3e85f
|
||||
Subproject commit 5821a82acc56ee215c3587c35f0a71c1ed38efe9
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE test_resource_pool
|
||||
ADD heap VARCHAR(200) NULL;
|
||||
ALTER TABLE test_resource_pool
|
||||
ADD gc_algo VARCHAR(200) NULL;
|
|
@ -53,7 +53,7 @@
|
|||
:destroy-on-close="true"
|
||||
v-loading="result.loading"
|
||||
>
|
||||
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule"
|
||||
<el-form :model="form" label-position="right" label-width="140px" size="small" :rules="rule"
|
||||
ref="testResourcePoolForm">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
|
@ -62,7 +62,13 @@
|
|||
<el-input v-model="form.description" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.image')" prop="image">
|
||||
<el-input v-model="form.image" autocomplete="off"/>
|
||||
<el-input v-model="form.image"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="Jmeter HEAP" prop="HEAP">
|
||||
<el-input v-model="form.heap" placeholder="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="Jmeter GC_ALGO" prop="GC_ALGO">
|
||||
<el-input v-model="form.gcAlgo" placeholder="-XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:G1ReservePercent=20"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('test_resource_pool.type')" prop="type">
|
||||
<el-select v-model="form.type" :placeholder="$t('test_resource_pool.select_pool_type')"
|
||||
|
|
Loading…
Reference in New Issue