Use of micro-benchmarks pressure measurement result correction

Some time ago to do a signature interface performance parameters to be tested, there is the text for the card: thread-safe class of applications in performance testing . One problem encountered when processing the test results: time-consuming because the machine signature, 10ms levels of concurrency can reach the level of 100ms. Therefore, data validation is particularly important.

Self-development of performance testing framework: performance testing framework for the third edition , complete project test script thread-safe class of applications in performance testing .

In two requests intermittent, just do a local collection, test data generation and signature of the test results, where the signature is the most time-consuming. This time after the completion of the test collect data on the need for an even rounds of micro benchmarks.

Tiny micro-benchmarks for measuring the performance of the code means, when compared with the time synchronization method with a call to the non-synchronization method comprises, the cost and expense of creating the thread pool threads, time-consuming time-consuming alternative thereto an algorithm implemented ,and many more.

Here is my assemble the parameters and signature methods, and processes a respective request commented after the method:

        @Override
        protected void doing() throws Exception {
            String url = com.okayqa.studentapd.base.OkayBase.HOST + "/api/member/createOrRenewMember"
            Map<String, String> p = new HashMap<>();
            p.put("days", "1");
            p.put("memberId", "208");
            p.put("orderNo", "F" + RString.getString(4) + i.getAndAdd(1));
            p.put("orderPaySystemId", "85123213");
            p.put("orderPayTime", "2020-02-09 10:00:00");
            p.put("payMoney", "30");
            p.put("recordSources", "3");
            p.put("renewal", "false");
            def user = Users.getStuUser(i.getAndAdd(1) % 1000)
//            output(user)
            p.put("systemId", user);
            String sign = RSAUtilLJT.sign(p, RSAUtilLJT.getPrivateKey(RSAUtilLJT.RSA_PRIVATE_KEY));
            p.put("sign", sign);
            HttpPost post = getHttpPost(url, JSON.toJSONString(p));
            def s = "F" + getNanoMark()
//            post.addHeader(getHeader("requestid", s));
//
//            def simlple = FanLibrary.excuteSimlple(post)
//            if (!simlple.contains("success")) {
//                logger.warn(s + OR + user + simlple.toString())
//                fail()
//            }
        }复制代码


        这样再运行接口压测脚本:
        复制代码
public static void main(String[] args) {
        def argsUtil = new ArgsUtil(args)
        def thread = argsUtil.getIntOrdefault(0, 1)
        def times = argsUtil.getIntOrdefault(1, 100)
        def reqs = []

        thread.times {
//            def mark = new HeaderMark("requestid")
            reqs << new Thr(times)
        }

        new Concurrent(reqs, "会员支付和续费接口").start()
        testOver()
    }复制代码

And the same number of threads to unsolicited test time consumed, and then subtracting this time from time interface performance tests like. This also has a problem: After the calibration data throughput should be higher than the actual value, because the unit is equivalent to a gap wait request, the server receiving data actually measured pressure is not corrected. In this regard, the article in the next issue I will share how to reduce the machine error.

  • Solemnly declare : The article first appeared in public No. "FunTester", prohibit third parties (except Tencent cloud) reproduce, publish.

Technology Featured articles

Non-technical Selected Articles

Guess you like

Origin juejin.im/post/5e44d041e51d4526ed66a6c6