This commit is contained in:
2018-08-14 18:37:34 +08:00
parent 97897db22c
commit 538f42181f
13 changed files with 34 additions and 43 deletions

View File

@@ -9,7 +9,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
* 异步请求压测
@@ -23,7 +22,7 @@ public class DidSdkPressAsyncTest {
@Test
public void pressAsyncTest() throws Exception {
SdkClient client = new SdkClient();
SdkClient client = new SdkClient("10.19.248.200",30581);
client.init();
client.start();
@@ -46,15 +45,16 @@ public class DidSdkPressAsyncTest {
});
}
// countDownLatch.await(10, TimeUnit.SECONDS);
countDownLatch.await();
end = System.currentTimeMillis();
cast = (end - start);
allcast += cast;
countDownLatch.await(10, TimeUnit.SECONDS);
logger.info("invokeAsync test num is: {}, cast time: {} millsec, throughput: {} send/millsec", NUM, cast, (double) NUM / cast);
amount += NUM;
NUM = NUM + 5000;
TimeUnit.SECONDS.sleep(2);
// NUM = NUM + 5000;
// TimeUnit.SECONDS.sleep(2);
}
logger.info("invokeAsync test all num is: {}, all cast time: {} millsec, all throughput: {} send/millsec", amount, allcast, (double) amount / allcast);

View File

@@ -6,8 +6,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
/**
* 同步请求压测
*
@@ -19,7 +17,7 @@ public class DidSdkPressSyncTest {
@Test
public void pressSyncTest() throws Exception {
SdkClient client = new SdkClient();
SdkClient client = new SdkClient("10.19.248.200",30581);
client.init();
client.start();
@@ -43,8 +41,8 @@ public class DidSdkPressSyncTest {
logger.info("invokeSync test num is: {}, cast time: {} millsec, throughput: {} send/millsec", NUM, cast, (double) NUM / cast);
amount += NUM;
NUM += 5000;
TimeUnit.SECONDS.sleep(2);
// NUM += 5000;
// TimeUnit.SECONDS.sleep(2);
}
logger.info("invokeSync test all num is: {}, all cast time: {} millsec, all throughput: {} send/millsec", amount, allcast, (double) amount / allcast);

View File

@@ -13,11 +13,11 @@ import java.util.concurrent.TimeUnit;
* @author ehlxr
*/
public class DidSdkTest {
private static final int NUM = 100;
private static final int NUM = 10;
@Test
public void didSdkTest() throws Exception {
SdkClient client = new SdkClient();
SdkClient client = new SdkClient("10.19.248.200", 30581);
client.init();
client.start();

View File

@@ -1,5 +1,5 @@
#Generated by Maven
#Tue Aug 14 15:16:54 CST 2018
#Tue Aug 14 18:31:54 CST 2018
version=1.0-SNAPSHOT
groupId=cn.ceres.did
artifactId=did-sdk