Unit testing and performance testing

Updated at:

This topic describes how to perform unit testing and performance testing during development with SOFARPC.

Unit testing

Add the sample unit test to your module. If your module relies on a third-party server such as ZooKeeper, add the server profile to the test-intergrated-3rd module. For more information, see the code of the registry-zookeeper module. If your module relies on other modules and integration testing is required, add the modules to the test/test-integrated module.

Performance testing

  1. Modify the following parameters to disable related items.

    -Dcontext.attachment.enable=false 
    -Dserialize.blacklist.enable=false 
    -Ddefault.tracer= false 
    -Dlogger.impl=com.alipay.sofa.rpc.log.SLF4JLoggerImpl 
    -Dmultiple.classloader.enable=false 
    -Devent.bus.enable=false
  2. Perform stress testing on bolt+hessian.

    Configure the stress testing environment:

    • Server: a virtual machine with 4 CPU cores and 8 GB memory, gigabit network, and JDK 1.8.0_111

    • Client: 50 concurrent requests

    The following table describes the stress testing results.

    Protocol

    Request

    Response

    Server

    TPS

    Average RT (ms)

    bolt+hessian

    1000 String

    1000 String

    Direct response

    10000

    1.93

    bolt+hessian

    1000 String

    1000 String

    Direct response

    20000

    4.13

    bolt+hessian

    1000 String

    1000 String

    Direct response

    30000

    7.32

    bolt+hessian

    1000 String

    1000 String

    Direct response

    40000

    15.78

    bolt+hessian

    1000 String

    1000 String

    Direct response

    50000 (close to the limit, with an error rate of 0.3%)

    26.51