压测参数
This commit is contained in:
@@ -41,7 +41,7 @@ public class DataFactory {
|
||||
|
||||
for(int i=0;i<totalCount;i++) {
|
||||
|
||||
int rand = RandomUtil.randomInt(0,2);
|
||||
int rand = RandomUtil.randomInt(0,3);
|
||||
|
||||
switch (rand)
|
||||
{
|
||||
@@ -267,7 +267,127 @@ public class DataFactory {
|
||||
"4367482505987361",
|
||||
"6222517213696554",
|
||||
"5588097736091856",
|
||||
"5274144695527717"};
|
||||
"5274144695527717",
|
||||
"4910324530476626",
|
||||
"5488446170650258",
|
||||
"5488442740532084",
|
||||
"4518102560628993",
|
||||
"5456199852397627",
|
||||
"6227506407600097",
|
||||
"5459473118226681",
|
||||
"4910325480725128",
|
||||
"5482595130517811",
|
||||
"4033611707045883",
|
||||
"4391885884392088",
|
||||
"6227509163790508",
|
||||
"4580717818338450",
|
||||
"4391886976436544",
|
||||
"4381255936183772",
|
||||
"5201521665038304",
|
||||
"4270104709788926",
|
||||
"5583604870359000",
|
||||
"4518042709565666",
|
||||
"4367688821593655",
|
||||
"4381266120937766",
|
||||
"5240478346281634",
|
||||
"4270206095387120",
|
||||
"5525994470729186",
|
||||
"4910325008575443",
|
||||
"6223497736660958",
|
||||
"5488442745158430",
|
||||
"6225004011817424",
|
||||
"5378303173084014",
|
||||
"5309807403661304",
|
||||
"5183643423875827",
|
||||
"4518105242408932",
|
||||
"4392257527193282",
|
||||
"4270298264677928",
|
||||
"6225007398018128",
|
||||
"6223478363752094",
|
||||
"4910404668267763",
|
||||
"5289318464854014",
|
||||
"4518100090689865",
|
||||
"5459475410983794",
|
||||
"9988002446337274",
|
||||
"6226305549870036",
|
||||
"9558824121303242",
|
||||
"6223057225815347",
|
||||
"4386005612410287",
|
||||
"6226222287684224",
|
||||
"1030000726548105507",
|
||||
"6223165274910453",
|
||||
"6223234755426774575",
|
||||
"6226921993916990",
|
||||
"1857203180318356",
|
||||
"8880008609586525",
|
||||
"6227006170404166009",
|
||||
"6222803729013494452",
|
||||
"6225980984265685",
|
||||
"6223486817999005",
|
||||
"622292384950941472",
|
||||
"6226154433191350",
|
||||
"6226308609744927",
|
||||
"6223252686599965",
|
||||
"6226989235246864",
|
||||
"6226315364035805",
|
||||
"6226924354312957",
|
||||
"622331121493374784",
|
||||
"4427293742040759",
|
||||
"6225803180076799",
|
||||
"6223242736822750591",
|
||||
"9558809266517375",
|
||||
"4336700211358470",
|
||||
"6222615188715415091",
|
||||
"6223123335184501",
|
||||
"6224919916945650",
|
||||
"6223285936394507787",
|
||||
"9558828996633930",
|
||||
"4340612371147193",
|
||||
"8701003818530478",
|
||||
"6223410074092270",
|
||||
"4427299996820101",
|
||||
"6227005520984333778",
|
||||
"8705007731518151",
|
||||
"6223392026205400",
|
||||
"6222607337440160627",
|
||||
"4026583347903103",
|
||||
"6225800938955811",
|
||||
"8701007476924006",
|
||||
"6224925409053324",
|
||||
"6226307585993920",
|
||||
"5264109147096266",
|
||||
"6223399787696123",
|
||||
"6226602718801911",
|
||||
"438589583329019216",
|
||||
"6226904359022603",
|
||||
"4340616703135248",
|
||||
"4026581250647808",
|
||||
"4427295109773880",
|
||||
"6225099304110017543",
|
||||
"6223333453435649",
|
||||
"94005652586006708",
|
||||
"6226601557827409",
|
||||
"6224985974044573702",
|
||||
"6223438112672689962",
|
||||
"6226818020801824298",
|
||||
"6226920625022441",
|
||||
"6223450061115365578",
|
||||
"6226925495683222",
|
||||
"6223127247481301",
|
||||
"6224987917149806624",
|
||||
"6223351946631319",
|
||||
"62231096270216434",
|
||||
"6227002362389092029",
|
||||
"62230850883263402",
|
||||
"6226170530609870",
|
||||
"9558811049452169",
|
||||
"6225096515560436494",
|
||||
"6223169645545410",
|
||||
"6223129466891145",
|
||||
"1030001094519248767",
|
||||
"62234072298103885",
|
||||
"6223129638985536"
|
||||
};
|
||||
|
||||
private final static String[] Surname = {"赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "褚", "卫", "蒋", "沈", "韩", "杨", "朱", "秦", "尤", "许",
|
||||
"何", "吕", "施", "张", "孔", "曹", "严", "华", "金", "魏", "陶", "姜", "戚", "谢", "邹", "喻", "柏", "水", "窦", "章", "云", "苏", "潘", "葛", "奚", "范", "彭", "郎",
|
||||
|
||||
@@ -20,8 +20,10 @@ public class FastDFS {
|
||||
|
||||
private static WageFileHandle wageFileHandle = new WageFileHandle();
|
||||
|
||||
private static String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0IiwiaWF0IjoxNjExNjU5MTYzLCJleHAiOjE2MTQyNTExNjN9.57I2zXMW_rgYJpoJf984NyJ019rRdyuCkgH8fluLaIbspHWp7tUjz570pptiHXjhCiHjpA5bfRgVbSC7HL_FvQ";
|
||||
private static String url = "http://192.168.17.4:8094";
|
||||
// private static String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0IiwiaWF0IjoxNjExNjU5MTYzLCJleHAiOjE2MTQyNTExNjN9.57I2zXMW_rgYJpoJf984NyJ019rRdyuCkgH8fluLaIbspHWp7tUjz570pptiHXjhCiHjpA5bfRgVbSC7HL_FvQ";
|
||||
private static String token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJtdXJvbmciLCJpYXQiOjE2MjU3MjI0OTUsImV4cCI6MTYyODMxNDQ5NX0.Qm3BzjxHWUdx5GPczYf8eRDZWbMcTGXs3VM5EnEm2fXm7BVW7FO6hsP8eSs-WVifJfmV-jhsgXMsMnY0q6qdng";
|
||||
// private static String url = "http://192.168.17.4:8094";
|
||||
private static String url = "http://172.17.11.90";
|
||||
private static String user = "test";
|
||||
private static String password="9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08";
|
||||
|
||||
@@ -33,7 +35,7 @@ public class FastDFS {
|
||||
|
||||
WageFileHandle wageFileHandle = new WageFileHandle();
|
||||
|
||||
token = wageFileHandle.getToken(url,user,password);
|
||||
// token = wageFileHandle.getToken(url,user,password);
|
||||
|
||||
Map result = wageFileHandle.uploadFile(token,url,file);
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.setting.Setting;
|
||||
import com.github.houbb.junitperf.core.annotation.JunitPerfConfig;
|
||||
import ctg.constant.PropConstants;
|
||||
import ctg.entity.api.Api;
|
||||
import ctg.entity.api.DiskApplyRequest;
|
||||
import ctg.entity.api.DiskResultRequest;
|
||||
@@ -61,8 +60,8 @@ public class StressTest {
|
||||
}
|
||||
|
||||
/** 压测入口 */
|
||||
@Test
|
||||
@JunitPerfConfig(threads = 2, warmUp = 1000, duration = 2000)
|
||||
// @JunitPerfConfig(threads = 1, warmUp = 0 , duration = 3000 )
|
||||
@JunitPerfConfig(threads = 50, warmUp = 3000 , duration = 1000 * 60 * 30)
|
||||
public void stressTest() {
|
||||
String threadName = Thread.currentThread().getName();
|
||||
log.info("{} started",threadName);
|
||||
@@ -72,8 +71,8 @@ public class StressTest {
|
||||
/** 生成测试批次 */
|
||||
String customerId = DataFactory.randomCustomerId();
|
||||
String titleId = DataFactory.randomTitleId();
|
||||
int totalCount = RandomUtil.randomInt(1,1000);
|
||||
BigDecimal totalAmount = RandomUtil.randomBigDecimal(new BigDecimal(1),new BigDecimal(1000000));
|
||||
int totalCount = RandomUtil.randomInt(2000,10000);
|
||||
BigDecimal totalAmount = RandomUtil.randomBigDecimal(new BigDecimal(5000),new BigDecimal(1000000));
|
||||
/** 新建文件 */
|
||||
File file = DiskTool.newSimpleDiskFile(customerId,titleId,"代发工资",totalCount,totalAmount);
|
||||
disk = diskApply(customerId,titleId,file);
|
||||
@@ -87,12 +86,13 @@ public class StressTest {
|
||||
|
||||
/* 批次为空(表示还在入库中),批次未终态(U:预计 0:成功 1:处理中) */
|
||||
while(result == null || StrUtil.equalsAny(result.getDiskSts(),"U","0","1")) {
|
||||
ThreadUtil.sleep(3);
|
||||
ThreadUtil.sleep(3000);
|
||||
result = diskResult(disk.getApplyDate(),disk.getDiskNo());
|
||||
}
|
||||
log.info("{} is completed, elapsed time:{}, disk:{}",threadName,timer.intervalSecond(threadName),result);
|
||||
}
|
||||
|
||||
/* 查询具体某一批次的结果 */
|
||||
@Test
|
||||
public void resultTest() throws Exception {
|
||||
DiskInfo disk = null;
|
||||
@@ -109,10 +109,11 @@ public class StressTest {
|
||||
/* 结果查询 */
|
||||
@SneakyThrows
|
||||
public DiskInfo diskResult(String applyDate,String diskNo) {
|
||||
log.info("applyDate:{} diskNo:{}",applyDate,diskNo);
|
||||
DiskResultRequest request = DiskResultRequest.builder().applyDate(applyDate).diskNo(diskNo).build();
|
||||
DiskInfo disk = new DiskInfo(applyDate,diskNo);
|
||||
Api<DiskResultRequest> api = new Api<>("diskResult",request);
|
||||
String response = HttpUtil.createPost(PropConstants.baseURL).header("Signature",api.signature()).body(api.toData()).setConnectionTimeout(3000).timeout(3000).execute().body();
|
||||
String response = HttpUtil.createPost(baseURL).header("Signature",api.signature()).body(api.toData()).setConnectionTimeout(3000).timeout(3000).execute().body();
|
||||
|
||||
Document doc = XmlUtil.readXML(response);
|
||||
String respCode = (String) XmlUtil.getByXPath("//root/head/respCode",doc, XPathConstants.STRING);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
## db.setting文件
|
||||
|
||||
url = jdbc:oracle:thin:@172.17.30.91:1521:mrdb
|
||||
user = mr_pay
|
||||
pass = mr_pay
|
||||
url = jdbc:oracle:thin:@192.168.3.191:1521:bidb
|
||||
user = MURONG_UAT2
|
||||
pass = MURONG_UAT2
|
||||
|
||||
## 可选配置
|
||||
# 是否在日志中显示执行的SQL
|
||||
|
||||
@@ -80,7 +80,8 @@
|
||||
|
||||
|
||||
|
||||
<root level="INFO">
|
||||
<!-- <root level="INFO">-->
|
||||
<root level="ERROR">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<!-- <appender-ref ref="FILE" />-->
|
||||
<!-- <appender-ref ref="FILE-error" />-->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
baseURL= http://172.17.20.91:9998/api
|
||||
baseURL= http://192.168.8.41/api
|
||||
secretKey = HelloWorld
|
||||
zipPassword = 1234567
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
baseURL= http://172.17.20.91:9998/api
|
||||
baseURL= http://192.168.8.41/api
|
||||
secretKey = HelloWorld
|
||||
zipPassword = 1234567
|
||||
|
||||
Reference in New Issue
Block a user