Redis performance testing practice of testing framework

First of all, let's share a test case of constantly adding key value to Redis.


The basic use case design idea is consistent with the previous pressure test, that is, a thread executes a task, then keeps doing something, then uses the thread pool to execute multiple tasks, and finally collects and summarizes the results.

From my own superficial understanding, ready makes the acquisition and release of connectives use a similar principle to the connectives of http protocol, that is, first obtain a connection, then do some operations, and then release the connection. Finally, a state management framework will be carried out in the connectives. The default management mechanism is provided for use here.

test case

Java version

 * redis Add key value performance test case
public class RedisPerTest extends SourceCode {

    public static final String host = "FunTester Hide address";

    public static final int port = 6379;

    public static RedisBase drive;

    public static void main(String[] args) {
        drive = new RedisBase(host, port);
        drive.index = 1;
        RUNUP_TIME = 0;
        drive.set("fun" + StringUtil.getString(10), "FunTester", 100);
        FunTester funTester = new FunTester(100);
        Concurrent concurrent = new Concurrent(funTester, 400,"redis add to key-value Performance test case");

    private static class FunTester extends FixedThread {

        public FunTester(int limit) {
            super(null, limit, true);

        protected void doing() throws Exception {
            drive.set("fun" + StringUtil.getString(10), "FunTester", 100);

        public ThreadBase clone() {
            return new FunTester(limit);



Groovy version


console output

INFO-> Current user: oker,Working directory:/Users/oker/IdeaProjects/funtester/,System coding format:UTF-8,system Mac OS X edition:10.16
INFO-> redis Connection pool IP:,Port: 6379, timeout setting: 5000
INFO-> =========Warm up complete,Start test!=========
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍  14% ,current QPS: 1605
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  23% ,current QPS: 1415
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  35% ,current QPS: 1632
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  46% ,current QPS: 1613
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  57% ,current QPS: 1255
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  69% ,current QPS: 1511
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  80% ,current QPS: 1653
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  92% ,current QPS: 1404
INFO-> thread :Redis Test 30,Execution times: 100, error times: 0,Total time: 25.874 s
INFO-> thread :Redis Test 11,Execution times: 96, error times: 0,Total time: 25.888 s
INFO-> thread :Redis Test 366,Execution times: 98, error times: 0,Total time: 25.744 s
 Omit 500 lines of log in the middle
INFO-> thread :Redis Test 377,Execution times: 98, error times: 0,Total time: 26.049 s
INFO-> thread :Redis Test 71,Execution times: 98, error times: 0,Total time: 26.21 s
INFO-> thread :Redis Test 388,Execution times: 98, error times: 0,Total time: 26.089 s
INFO-> Redis Test progress:▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍▍  100%
     Redis test QPS Change curve     
    See the figure below

INFO-> Total 400 threads, shared: 26.252 s,Total implementation:38,905,Number of errors:0,Number of failures:0
INFO-> Data saved successfully! File name:/Users/oker/IdeaProjects/funtester/long/data/Redis Test 021516_400
~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~ JSON ~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~
>  {
>  ① . "rt":267,
>  ① . "failRate":0.0,
>  ① . "threads":400,
>  ① . "deviation":"1.08%",
>  ① . "errorRate":0.0,
>  ① . "executeTotal":38905,
>  ① . "qps2":1481.9823251561786,
>  ① . "total":38905,
>  ① . "qps":1498.1273408239701,
>  ① . "startTime":"2021-09-02 15:16:35",
>  ① . "endTime":"2021-09-02 15:17:01",
>  ① . "mark":"Redis Test 021516",
>  ① . "table":"eJztk8sKgkAUQPeB/3A/QMFMWvgZ0Q8IDiQ0Fk1BLXtR0Lr5jVb90Cyiz+j2wB5UWj6m4A4XdKPnnHE0KpBuNVgQit12td+swbVt6Ld6zA9SPmxUjPecBhPdTiQYNEPOPBhagvVCvw3RgJswsjjC/SiJkezBwwjO7/IcpwZcmNwfem61jrc5VGRdSi5xUpUQpSyKkjOcckgnRNEkJcc45dFuMYXSlJzjlENUcoKDlwXOc2S+5PirXU5jIjc3izh1inPd5A8FMljF6fcel43IUedj4/dmWgS/KHo8Wq//ov+8HAt/QIMKqZAK9WtQIRVSoX4NKqRCKtSvQYVUSIX6NQotPAA24o0Q"
>  }
~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~ JSON ~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~~☢~
                                       Redis Test 400 thread                                       

                    See the figure below

Process finished with exit code 0

Redis test QPS change curve.png

Redis test 400thread.png


Generally speaking, it is still relatively simple. In the next phase, we will test the scenario of multi operation correlation or collection value, and Redis self increasing value. When communicating with peers, they said that it is difficult to directly test Redis in their daily work. But if you have skills, it's good to make some reserves. After all, I don't know when it will be used.

Finally, we can pay attention to the official account: the sad spicy strip! There are many data sharing! The materials are the knowledge points that the interviewer must ask during the interview, and also include many common knowledge in the testing industry, including basic knowledge, Linux essentials, Shell, Internet program principles, Mysql database, special topics of packet capture tools, interface testing tools, advanced testing Python programming, Web automation testing, APP automation testing, interface automation testing Test advanced continuous integration, test architecture development, test framework, performance test, security test, etc.

If my blog is helpful to you and you like my blog content, please click "like", "comment" and "collect" for three times! Recommended software testing communication and learning group: 914172719, which will share some videos recorded by senior architects

Haowen recommendation

Job transfer interview, job hopping interview, these interview skills that software testers must know!

Interview experience: move bricks in first tier cities! Another software testing post, 5000 will be satisfied

Interviewer: I've worked for three years and have a preliminary test? I'm afraid your title of software test engineer should be enclosed in double quotation marks

What kind of person is suitable for software testing?

The man who left work on time was promoted before me

The test post changed jobs repeatedly and disappeared

Tags: Java Database Redis Programmer software testing

Posted on Sat, 18 Sep 2021 14:59:03 -0400 by shinyo