dubboサービス圧力テスト

4603 ワード

ここではタオバオが提供する圧力測定ツールを紹介します。
1、pomの導入
<dependency>
    <groupId>com.taobaogroupId>
    <artifactId>stresstesterartifactId>
    <version>1.0version>
dependency>
ここに依存していないが、Jarの設定dubboクライアントプロファイルを提供しています。ここでは書き込みません。
public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "classpath:conf/spring.xml" });
        final PromotionCartServiceClient demoService = (PromotionCartServiceClient) context.getBean("PromotionCartServiceClient"); //      
        StressTestUtils.testAndPrint(100, 1000000, new StressTask() {

            public Object doTask() throws Exception {
                List promoIds = new ArrayList();
                promoIds.add("0722d1aa9dcb4881bb6c7ad7cae76df6");
                ResultDTO deductionPriceResource = demoService.deductionPriceResource(promoIds, UUID.randomUUID().toString(), "1443", "951023562960");

                return null;
            }
        });
        System.exit(0);
    }
Stress TestUtils.testAndPrint(100,100000,new Stres Task){….
100は合併数です
100000は請求回数です。
3、圧力測定結果
 Concurrency Level: 100--   
 Time taken for tests:  41.175274 ms--    
 Complete Requests: 100--      
 Failed Requests:   0--    
 Requests per second:   3633.8547--QPS
 Time per request:  27.518986 ms--    
 Time per request:  0.27518988 ms (across all concurrent requests)--    ,      
 Shortest request:  10.093374 ms--    
 Percentage of the requests served within a certain time (ms)
  50%   29.744219--50%     0.005703    
  66%   32.11875
  75%   33.670345
  80%   34.80021
  90%   38.767384
  95%   40.011738
  98%   40.90684
  99%   41.175274
 100%   41.175274 (longest request)--