OpenResty 高阶实战之————Redis授权登录使用短连接(5000)和长连接(500W) 使用连接池AB压力测试结果

本文涉及的产品
云数据库 Redis 版,标准版 2GB
推荐场景:
搭建游戏排行榜
云原生内存数据库 Tair,内存型 2GB
简介: 一、短连接开始测试ab -n 5000 -c 100 -k 127.0.0.1/test_redis_short#demo1Concurrency Level: 100Time taken for tests: 0.

 

一、短连接开始测试

ab -n 5000 -c 100 -k 127.0.0.1/test_redis_short

#demo1

Concurrency Level:      100
Time taken for tests:   0.745 seconds
Complete requests:      5000
Failed requests:        0
Keep-Alive requests:    5000
Total transferred:      1095000 bytes
HTML transferred:       330000 bytes
Requests per second:    6708.13 [#/sec] (mean)
Time per request:       14.907 [ms] (mean)
Time per request:       0.149 [ms] (mean, across all concurrent requests)
Transfer rate:          1434.65 [Kbytes/sec] received

#demo2

Concurrency Level:      100
Time taken for tests:   0.697 seconds
Complete requests:      5000
Failed requests:        0
Keep-Alive requests:    5000
Total transferred:      1095000 bytes
HTML transferred:       330000 bytes
Requests per second:    7177.65 [#/sec] (mean)
Time per request:       13.932 [ms] (mean)
Time per request:       0.139 [ms] (mean, across all concurrent requests)
Transfer rate:          1535.06 [Kbytes/sec] received

ab -n 10000 -c 100 -k 127.0.0.1/test_redis_short

#demo1

Concurrency Level:      100
Time taken for tests:   1.211 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9945
Total transferred:      2189725 bytes
HTML transferred:       660000 bytes
Requests per second:    8256.17 [#/sec] (mean)
Time per request:       12.112 [ms] (mean)
Time per request:       0.121 [ms] (mean, across all concurrent requests)
Transfer rate:          1765.50 [Kbytes/sec] received

#demo2 比较卡

Concurrency Level:      100
Time taken for tests:   17.364 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9948
Total transferred:      2189740 bytes
HTML transferred:       660000 bytes
Requests per second:    575.90 [#/sec] (mean)
Time per request:       173.643 [ms] (mean)
Time per request:       1.736 [ms] (mean, across all concurrent requests)
Transfer rate:          123.15 [Kbytes/sec] received

ab -n 20000 -c 100 -k 127.0.0.1/test_redis_short

#demo1

Concurrency Level:      100
Time taken for tests:   19.374 seconds
Complete requests:      20000
Failed requests:        116
   (Connect: 0, Receive: 0, Length: 116, Exceptions: 0)
Keep-Alive requests:    19866
Total transferred:      4377590 bytes
HTML transferred:       1318260 bytes
Requests per second:    1032.32 [#/sec] (mean)
Time per request:       96.869 [ms] (mean)
Time per request:       0.969 [ms] (mean, across all concurrent requests)
Transfer rate:          220.66 [Kbytes/sec] received

Nginx CPU内存情况

 

ab -n 30000 -c 100 -k 127.0.0.1/test_redis_short

#demo1

Concurrency Level:      100
Time taken for tests:   50.960 seconds
Complete requests:      30000
Failed requests:        20304
   (Connect: 0, Receive: 0, Length: 20304, Exceptions: 0)
Keep-Alive requests:    29767
Total transferred:      6423395 bytes
HTML transferred:       1834560 bytes
Requests per second:    588.69 [#/sec] (mean)
Time per request:       169.867 [ms] (mean)
Time per request:       1.699 [ms] (mean, across all concurrent requests)
Transfer rate:          123.09 [Kbytes/sec] received

Nginx CPU内存情况

短连接一旦-n 大于 10000 ,nginx 刚开始直接100%,但是redis-server 负载相对较小,以下是 -n = 40000

Requests per second:    1105.62 [#/sec] (mean)

第二次 -n = 40000 测试结果

Requests per second:    933.82 [#/sec] (mean)

总结:

  使用短连接一开始nginx 负载就满载100% ,太可怕了,但是redis-server 负载相对较小,(30000--->100%) 、(20000--->90%)、(10000--->70~90%),测试数据显示,安全最大连接在5000 以内

 

二、长连接开始测试

ab -n 5000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   0.289 seconds
Complete requests:      5000
Failed requests:        0
Keep-Alive requests:    5000
Total transferred:      1035000 bytes
HTML transferred:       270000 bytes
Requests per second:    17322.98 [#/sec] (mean)
Time per request:       5.773 [ms] (mean)
Time per request:       0.058 [ms] (mean, across all concurrent requests)
Transfer rate:          3501.81 [Kbytes/sec] received

#demo2

Concurrency Level:      100
Time taken for tests:   0.278 seconds
Complete requests:      5000
Failed requests:        0
Keep-Alive requests:    5000
Total transferred:      1035000 bytes
HTML transferred:       270000 bytes
Requests per second:    17977.46 [#/sec] (mean)
Time per request:       5.563 [ms] (mean)
Time per request:       0.056 [ms] (mean, across all concurrent requests)
Transfer rate:          3634.12 [Kbytes/sec] received

ab -n 10000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   0.670 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9905
Total transferred:      2069525 bytes
HTML transferred:       540000 bytes
Requests per second:    14927.29 [#/sec] (mean)
Time per request:       6.699 [ms] (mean)
Time per request:       0.067 [ms] (mean, across all concurrent requests)
Transfer rate:          3016.84 [Kbytes/sec] received

#demo2

Concurrency Level:      100
Time taken for tests:   0.812 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9915
Total transferred:      2069575 bytes
HTML transferred:       540000 bytes
Requests per second:    12310.57 [#/sec] (mean)
Time per request:       8.123 [ms] (mean)
Time per request:       0.081 [ms] (mean, across all concurrent requests)
Transfer rate:          2488.05 [Kbytes/sec] received

#demo3

Concurrency Level:      100
Time taken for tests:   0.662 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9942
Total transferred:      2069710 bytes
HTML transferred:       540000 bytes
Requests per second:    15114.05 [#/sec] (mean)
Time per request:       6.616 [ms] (mean)
Time per request:       0.066 [ms] (mean, across all concurrent requests)
Transfer rate:          3054.85 [Kbytes/sec] received

ab -n 20000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   0.981 seconds
Complete requests:      20000
Failed requests:        0
Keep-Alive requests:    19869
Total transferred:      4139345 bytes
HTML transferred:       1080000 bytes
Requests per second:    20390.39 [#/sec] (mean)
Time per request:       4.904 [ms] (mean)
Time per request:       0.049 [ms] (mean, across all concurrent requests)
Transfer rate:          4121.23 [Kbytes/sec] received

ab -n 30000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   1.392 seconds
Complete requests:      30000
Failed requests:        0
Keep-Alive requests:    29745
Total transferred:      6208725 bytes
HTML transferred:       1620000 bytes
Requests per second:    21556.79 [#/sec] (mean)
Time per request:       4.639 [ms] (mean)
Time per request:       0.046 [ms] (mean, across all concurrent requests)
Transfer rate:          4356.78 [Kbytes/sec] received

ab -n 40000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   1.711 seconds
Complete requests:      40000
Failed requests:        0
Keep-Alive requests:    39651
Total transferred:      8278255 bytes
HTML transferred:       2160000 bytes
Requests per second:    23377.05 [#/sec] (mean)
Time per request:       4.278 [ms] (mean)
Time per request:       0.043 [ms] (mean, across all concurrent requests)
Transfer rate:          4724.64 [Kbytes/sec] received

ab -n 50000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   1.995 seconds
Complete requests:      50000
Failed requests:        0
Keep-Alive requests:    49555
Total transferred:      10347775 bytes
HTML transferred:       2700000 bytes
Requests per second:    25059.81 [#/sec] (mean)
Time per request:       3.990 [ms] (mean)
Time per request:       0.040 [ms] (mean, across all concurrent requests)
Transfer rate:          5064.71 [Kbytes/sec] received

ab -n 100000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   3.613 seconds
Complete requests:      100000
Failed requests:        0
Keep-Alive requests:    99049
Total transferred:      20695245 bytes
HTML transferred:       5400000 bytes
Requests per second:    27676.11 [#/sec] (mean)
Time per request:       3.613 [ms] (mean)
Time per request:       0.036 [ms] (mean, across all concurrent requests)
Transfer rate:          5593.40 [Kbytes/sec] received

ab -n 200000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   7.562 seconds
Complete requests:      200000
Failed requests:        0
Keep-Alive requests:    198052
Total transferred:      41390260 bytes
HTML transferred:       10800000 bytes
Requests per second:    26447.14 [#/sec] (mean)
Time per request:       3.781 [ms] (mean)
Time per request:       0.038 [ms] (mean, across all concurrent requests)
Transfer rate:          5344.99 [Kbytes/sec] received

ab -n 500000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   17.541 seconds
Complete requests:      500000
Failed requests:        0
Keep-Alive requests:    495051
Total transferred:      103475255 bytes
HTML transferred:       27000000 bytes
Requests per second:    28505.36 [#/sec] (mean)
Time per request:       3.508 [ms] (mean)
Time per request:       0.035 [ms] (mean, across all concurrent requests)
Transfer rate:          5760.94 [Kbytes/sec] received

ab -n 1000000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   36.749 seconds
Complete requests:      1000000
Failed requests:        0
Keep-Alive requests:    990054
Total transferred:      206950270 bytes
HTML transferred:       54000000 bytes
Requests per second:    27211.29 [#/sec] (mean)
Time per request:       3.675 [ms] (mean)
Time per request:       0.037 [ms] (mean, across all concurrent requests)
Transfer rate:          5499.40 [Kbytes/sec] received

ab -n 1500000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   57.548 seconds
Complete requests:      1500000
Failed requests:        0
Keep-Alive requests:    1485050
Total transferred:      310425250 bytes
HTML transferred:       81000000 bytes
Requests per second:    26065.16 [#/sec] (mean)
Time per request:       3.837 [ms] (mean)
Time per request:       0.038 [ms] (mean, across all concurrent requests)
Transfer rate:          5267.76 [Kbytes/sec] received

ab -n 2000000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   76.746 seconds
Complete requests:      2000000
Failed requests:        0
Keep-Alive requests:    1980048
Total transferred:      413900240 bytes
HTML transferred:       108000000 bytes
Requests per second:    26060.04 [#/sec] (mean)
Time per request:       3.837 [ms] (mean)
Time per request:       0.038 [ms] (mean, across all concurrent requests)
Transfer rate:          5266.73 [Kbytes/sec] received

Nginx CPU内存情况

ab -n 2500000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   90.761 seconds
Complete requests:      2500000
Failed requests:        0
Keep-Alive requests:    2475045
Total transferred:      517375225 bytes
HTML transferred:       135000000 bytes
Requests per second:    27544.95 [#/sec] (mean)
Time per request:       3.630 [ms] (mean)
Time per request:       0.036 [ms] (mean, across all concurrent requests)
Transfer rate:          5566.83 [Kbytes/sec] received

Nginx CPU内存情况

 

长连接-n = 2500000 ,nginx 刚开始不会超过50%,但是redis-server 负载相对高点,最高在50%左右,测试结果: 

 

Concurrency Level:      100
Time taken for tests:   93.482 seconds
Complete requests:      2500000
Failed requests:        0
Keep-Alive requests:    2475048
Total transferred:      517375240 bytes
HTML transferred:       135000000 bytes
Requests per second:    26743.15 [#/sec] (mean)
Time per request:       3.739 [ms] (mean)
Time per request:       0.037 [ms] (mean, across all concurrent requests)
Transfer rate:          5404.78 [Kbytes/sec] received

 

 

ab -n 5000000 -c 100 -k 127.0.0.1/test_redis_long

#demo1

Concurrency Level:      100
Time taken for tests:   221.492 seconds
Complete requests:      5000000
Failed requests:        0
Keep-Alive requests:    4950051
Total transferred:      1034750255 bytes
HTML transferred:       270000000 bytes
Requests per second:    22574.15 [#/sec] (mean)
Time per request:       4.430 [ms] (mean)
Time per request:       0.044 [ms] (mean, across all concurrent requests)
Transfer rate:          4562.23 [Kbytes/sec] received

Nginx CPU内存情况

Completed 2000000 requests  请求截图

 Completed 3500000 requests  请求截图 ,这时候的redis-server 负载保持在38%左右

测试到最后AB 压力直接爆掉

 

(-n---->nginx负载----->redis-server负载---->Requests per second)、

(100000--->37%--->37%---->28303.90) 表示很快完成

(200000--->50%--->56%--->33518.21)

(500000--->67%--->74%--->23959.52) redis-server 不稳定

(1000000--->50%--->50%--->23959.52) 2个都比较稳定,都能够保持在50%以下

总结:

  使用长连接,10W 连接时毫无压力的,示,安全最大连接在20W 以内(测试环境可以100W没问题)

1、短连接Nginx负载太高 10000 链接负载直接飙到90+%

 

三、测试代码

test_long.lua

--[[-----------------------------------------------------------------------
* |  Copyright (C) Shaobo Wan (Tinywan)
* |  Github: https://github.com/Tinywan
* |  Author: Tinywan
* |  Date: 2017/5/8 16:25
* |  Mail: Overcome.wan@Gmail.com
* |------------------------------------------------------------------------
* |  version: 1.0
* |  description: redis 长连接带连接池测试
* |------------------------------------------------------------------------
--]]
local redis = require "resty.redis"
local red = redis:new()

local ok, err = red:connect("127.0.0.1", 63700)
if not ok then
    ngx.say("failed to connect: ", err)
    return
end

-- auth
local count
count, err = red:get_reused_times()
if 0 == count then
    local res, err = red:auth("tinywan123456")
    if not res then
        ngx.say("failed to authenticate: ", err)
        return
    end
elseif err then
    ngx.say("failed to get_reused_times: ", err)
end


ok, err = red:set("dog_test_long", "an animal 222"..ngx.time())
if not ok then
    ngx.say("failed to set dog: ", err)
    return
end

ngx.say("set result: ", ok)

local res, err = red:get("dog_test_long")
if not res then
    ngx.say("failed to get dog: ", err)
    return
end

if res == ngx.null then
    ngx.say("dog not found.")
    return
end

ngx.say("dog_test_long: ", res)

local ok, err = red:set_keepalive(10000, 100)
if not ok then
    ngx.say("failed to set keepalive: ", err)
    return
end

test_short.lua

--[[-----------------------------------------------------------------------
* |  Copyright (C) Shaobo Wan (Tinywan)
* |  Github: https://github.com/Tinywan
* |  Author: Tinywan
* |  Date: 2017/5/8 16:25
* |  Mail: Overcome.wan@Gmail.com
* |------------------------------------------------------------------------
* |  version: 1.0
* |  description: redis 短连接测试
* |------------------------------------------------------------------------
--]]
local redis = require "resty.redis"
local red = redis:new()

--red:set_timeout(1000) -- 1 sec

-- or connect to a unix domain socket file listened
-- by a redis server:
--     local ok, err = red:connect("unix:/path/to/redis.sock")

local ok, err = red:connect("127.0.0.1", 63700)
if not ok then
    ngx.say("failed to connect: ", err)
    return
end

local res, err = red:auth("tinywan123456")
if not res then
    ngx.say("failed to authenticate: ", err)
    return
end

ok, err = red:set("dog_test_short", "an animal dog_test_short"..ngx.time())
if not ok then
    ngx.say("failed to set dog: ", err)
    return
end

ngx.say("set result: ", ok)

local res, err = red:get("dog_test_short")
if not res then
    ngx.say("failed to get dog: ", err)
    return
end

if res == ngx.null then
    ngx.say("dog not found.")
    return
end

ngx.say("dog_test_short: ", res)

 

 redis_iresty_short.lua

--[[-----------------------------------------------------------------------
* |  Copyright (C) Shaobo Wan (Tinywan)
* |  Github: https://github.com/Tinywan
* |  Author: Tinywan
* |  Date: 2017/5/8 16:25
* |  Mail: Overcome.wan@Gmail.com
* |------------------------------------------------------------------------
* |  version: 1.0
* |  description: redis_iresty 短连接测试
* |------------------------------------------------------------------------
--]]
local redis = require "resty.redis_iresty"
local red = redis:new()

local res, err = red:auth("tinywan123456")
if not res then
    ngx.say("failed to authenticate: ", err)
    return
end

local ok, err = red:set("OPenresty_short", "NGINX-based OPenresty_short")
if not ok then
    ngx.say("failed to set: ", err)
    return
end

ngx.say("set result: ", ok)

 

 ab -n 5000 -c 100 -k 127.0.0.1/redis_iresty_short

Concurrency Level:      100
Time taken for tests:   0.682 seconds
Complete requests:      5000
Failed requests:        0
Keep-Alive requests:    5000
Total transferred:      840000 bytes
HTML transferred:       75000 bytes
Requests per second:    7332.55 [#/sec] (mean)
Time per request:       13.638 [ms] (mean)
Time per request:       0.136 [ms] (mean, across all concurrent requests)
Transfer rate:          1203.00 [Kbytes/sec] received

 

ab -n 10000 -c 100 -k 127.0.0.1/redis_iresty_short

Concurrency Level:      100
Time taken for tests:   1.120 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9900
Total transferred:      1679500 bytes
HTML transferred:       150000 bytes
Requests per second:    8925.68 [#/sec] (mean)
Time per request:       11.204 [ms] (mean)
Time per request:       0.112 [ms] (mean, across all concurrent requests)
Transfer rate:          1463.93 [Kbytes/sec] received

 

 ab -n 100000 -c 100 -k 127.0.0.1/redis_iresty_short

Concurrency Level:      100
Time taken for tests:   10.308 seconds
Complete requests:      100000
Failed requests:        0
Keep-Alive requests:    99051
Total transferred:      16795255 bytes
HTML transferred:       1500000 bytes
Requests per second:    9701.45 [#/sec] (mean)
Time per request:       10.308 [ms] (mean)
Time per request:       0.103 [ms] (mean, across all concurrent requests)
Transfer rate:          1591.19 [Kbytes/sec] received

CPU

 

  ab -n 500000 -c 100 -k 127.0.0.1/redis_iresty_short

Concurrency Level:      100
Time taken for tests:   55.198 seconds
Complete requests:      500000
Failed requests:        0
Keep-Alive requests:    495047
Total transferred:      83975235 bytes
HTML transferred:       7500000 bytes
Requests per second:    9058.32 [#/sec] (mean)
Time per request:       11.040 [ms] (mean)
Time per request:       0.110 [ms] (mean, across all concurrent requests)
Transfer rate:          1485.69 [Kbytes/sec] received

 

 ab -n 1000000 -c 100 -k 127.0.0.1/redis_iresty_short

Concurrency Level:      100
Time taken for tests:   112.221 seconds
Complete requests:      1000000
Failed requests:        0
Keep-Alive requests:    990050
Total transferred:      167950250 bytes
HTML transferred:       15000000 bytes
Requests per second:    8911.00 [#/sec] (mean)
Time per request:       11.222 [ms] (mean)
Time per request:       0.112 [ms] (mean, across all concurrent requests)
Transfer rate:          1461.53 [Kbytes/sec] received

CPU 负载

 

 

 ab -n 5000000 -c 100 -k 127.0.0.1/redis_iresty_short 

比较慢,但是能跑

Concurrency Level:      100
Time taken for tests:   534.139 seconds
Complete requests:      5000000
Failed requests:        0
Keep-Alive requests:    4950051
Total transferred:      839750255 bytes
HTML transferred:       75000000 bytes
Requests per second:    9360.85 [#/sec] (mean)
Time per request:       10.683 [ms] (mean)
Time per request:       0.107 [ms] (mean, across all concurrent requests)
Transfer rate:          1535.31 [Kbytes/sec] received

 

redis_iresty_long.lua

--[[-----------------------------------------------------------------------
* |  Copyright (C) Shaobo Wan (Tinywan)
* |  Github: https://github.com/Tinywan
* |  Author: Tinywan
* |  Date: 2017/5/8 16:25
* |  Mail: Overcome.wan@Gmail.com
* |------------------------------------------------------------------------
* |  version: 1.0
* |  description: redis_iresty 长连接带连接池测试
* |------------------------------------------------------------------------
--]]
local redis = require "resty.redis_iresty"
local red = redis:new()

-- auth
local count
count, err = red:get_reused_times()
if 0 == count then
    local res, err = red:auth("tinywan123456")
    if not res then
        ngx.say("failed to authenticate: ", err)
        return
    end
elseif err then
    ngx.say("failed to get_reused_times: ", err)
end

local ok, err = red:set("OPenresty", "NGINX-based Media Streaming Server")
if not ok then
    ngx.say("failed to set: ", err)
    return
end

ngx.say("set result: ", ok)

local ok, err = red:set_keepalive(10000, 100)
if not ok then
    ngx.say("failed to set keepalive: ", err)
    return
end

  ab -n 5000 -c 100 -k 127.0.0.1/redis_iresty_long   很好

Concurrency Level:      100
Time taken for tests:   1.110 seconds
Complete requests:      5000
Failed requests:        0
Non-2xx responses:      5000
Keep-Alive requests:    0
Total transferred:      1835000 bytes
HTML transferred:       995000 bytes
Requests per second:    4502.59 [#/sec] (mean)
Time per request:       22.209 [ms] (mean)
Time per request:       0.222 [ms] (mean, across all concurrent requests)
Transfer rate:          1613.72 [Kbytes/sec] received

 ab -n 10000 -c 100 -k 127.0.0.1/redis_iresty_long  很好

Concurrency Level:      100
Time taken for tests:   2.065 seconds
Complete requests:      10000
Failed requests:        0
Non-2xx responses:      10000
Keep-Alive requests:    0
Total transferred:      3670000 bytes
HTML transferred:       1990000 bytes
Requests per second:    4843.59 [#/sec] (mean)
Time per request:       20.646 [ms] (mean)
Time per request:       0.206 [ms] (mean, across all concurrent requests)
Transfer rate:          1735.94 [Kbytes/sec] received

 

ab -n 100000 -c 100 -k 127.0.0.1/redis_iresty_long   不是很好(不推荐)

Concurrency Level:      100
Time taken for tests:   19.675 seconds
Complete requests:      100000
Failed requests:        0
Non-2xx responses:      100000
Keep-Alive requests:    0
Total transferred:      36700000 bytes
HTML transferred:       19900000 bytes
Requests per second:    5082.71 [#/sec] (mean)
Time per request:       19.675 [ms] (mean)
Time per request:       0.197 [ms] (mean, across all concurrent requests)
Transfer rate:          1821.64 [Kbytes/sec] received

 CPU 负载

 

 ab -n 500000 -c 100 -k 127.0.0.1/redis_iresty_long  不是很好(不推荐)

Concurrency Level:      100
Time taken for tests:   95.891 seconds
Complete requests:      500000
Failed requests:        0
Non-2xx responses:      500000
Keep-Alive requests:    0
Total transferred:      183500000 bytes
HTML transferred:       99500000 bytes
Requests per second:    5214.28 [#/sec] (mean)
Time per request:       19.178 [ms] (mean)
Time per request:       0.192 [ms] (mean, across all concurrent requests)
Transfer rate:          1868.79 [Kbytes/sec] received

 

 ab -n 1000000 -c 100 -k 127.0.0.1/redis_iresty_long   (不推荐)下面不再测试

Concurrency Level:      100
Time taken for tests:   190.008 seconds
Complete requests:      1000000
Failed requests:        0
Non-2xx responses:      1000000
Keep-Alive requests:    0
Total transferred:      367000000 bytes
HTML transferred:       199000000 bytes
Requests per second:    5262.94 [#/sec] (mean)
Time per request:       19.001 [ms] (mean)
Time per request:       0.190 [ms] (mean, across all concurrent requests)
Transfer rate:          1886.23 [Kbytes/sec] received

CPU 

 

 

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
3天前
|
缓存 测试技术 Apache
告别卡顿!Python性能测试实战教程,JMeter&Locust带你秒懂性能优化💡
【9月更文挑战第5天】性能测试是确保应用在高负载下稳定运行的关键。本文介绍Apache JMeter和Locust两款常用性能测试工具,帮助识别并解决性能瓶颈。JMeter适用于测试静态和动态资源,而Locust则通过Python脚本模拟HTTP请求。文章详细讲解了安装、配置及使用方法,并提供了实战案例,帮助你掌握性能测试技巧,提升应用性能。通过分析测试结果、模拟并发、检查资源使用情况及代码优化,确保应用在高并发环境下表现优异。
20 5
|
2天前
|
测试技术 Apache 数据库
从慢如蜗牛到飞一般的感觉!Python性能测试实战,JMeter&Locust助你加速🏃‍♂️
【9月更文挑战第6天】你的Python应用是否曾因响应缓慢而让用户望而却步?借助JMeter与Locust,这一切将迎刃而解。JMeter作为Apache基金会的明星项目,以其强大的跨平台和多协议支持能力,成为性能测试领域的魔法师;而Locust则以Python的简洁与高效,让性能测试更加灵活。通过实战演练,你可以利用这两款工具轻松识别并解决性能瓶颈,优化数据库查询、网络配置等,最终使应用变得敏捷高效,轻松应对高并发挑战。
7 1
|
5天前
|
Kubernetes Linux API
CentOS 7.6使用kubeadm部署k8s 1.17.2测试集群实战篇
该博客文章详细介绍了在CentOS 7.6操作系统上使用kubeadm工具部署kubernetes 1.17.2版本的测试集群的过程,包括主机环境准备、安装Docker、配置kubelet、初始化集群、添加节点、部署网络插件以及配置k8s node节点管理api server服务器。
21 0
CentOS 7.6使用kubeadm部署k8s 1.17.2测试集群实战篇
|
11天前
|
测试技术 API 开发者
.NET单元测试框架大比拼:MSTest、xUnit与NUnit的实战较量与选择指南
【8月更文挑战第28天】单元测试是软件开发中不可或缺的一环,它能够确保代码的质量和稳定性。在.NET生态系统中,MSTest、xUnit和NUnit是最为流行的单元测试框架。本文将对这三种测试框架进行全面解析,并通过示例代码展示它们的基本用法和特点。
25 7
|
8天前
|
运维 监控 NoSQL
【Redis】哨兵(Sentinel)原理与实战全解~炒鸡简单啊
Redis 的哨兵模式(Sentinel)是一种用于实现高可用性的机制。它通过监控主节点和从节点,并在主节点故障时自动进行切换,确保集群持续提供服务。哨兵模式包括主节点、从节点和哨兵实例,具备监控、通知、自动故障转移等功能,能显著提高系统的稳定性和可靠性。本文详细介绍了哨兵模式的组成、功能、工作机制以及其优势和局限性,并提供了单实例的安装和配置步骤,包括系统优化、安装、配置、启停管理和性能监控等。此外,还介绍了如何配置主从复制和哨兵,确保在故障时能够自动切换并恢复服务。
|
9天前
|
IDE Java 测试技术
揭秘Java高效编程:测试与调试实战策略,让你代码质量飞跃,职场竞争力飙升!
【8月更文挑战第30天】在软件开发中,测试与调试对确保代码质量至关重要。本文通过对比单元测试、集成测试、调试技巧及静态代码分析,探讨了多种实用的Java测试与调试策略。JUnit和Mockito分别用于单元测试与集成测试,有助于提前发现错误并提高代码可维护性;Eclipse和IntelliJ IDEA内置调试器则能快速定位问题;Checkstyle和PMD等工具则通过静态代码分析发现潜在问题。综合运用这些策略,可显著提升代码质量,为项目成功打下坚实基础。
26 2
|
7天前
|
API 开发者 Java
API 版本控制不再难!Spring 框架带你玩转多样化的版本管理策略,轻松应对升级挑战!
【8月更文挑战第31天】在开发RESTful服务时,为解决向后兼容性问题,常需进行API版本控制。本文以Spring框架为例,探讨四种版本控制策略:URL版本控制、请求头版本控制、查询参数版本控制及媒体类型版本控制,并提供示例代码。此外,还介绍了通过自定义注解与过滤器实现更灵活的版本控制方案,帮助开发者根据项目需求选择最适合的方法,确保API演化的管理和客户端使用的稳定与兼容。
38 0
|
10天前
|
缓存 NoSQL Java
惊!Spring Boot遇上Redis,竟开启了一场缓存实战的革命!
【8月更文挑战第29天】在互联网时代,数据的高速读写至关重要。Spring Boot凭借简洁高效的特点广受开发者喜爱,而Redis作为高性能内存数据库,在缓存和消息队列领域表现出色。本文通过电商平台商品推荐系统的实战案例,详细介绍如何在Spring Boot项目中整合Redis,提升系统响应速度和用户体验。
36 0
|
16天前
|
缓存 NoSQL 测试技术
【Azure Redis 缓存 Azure Cache For Redis】使用Redis自带redis-benchmark.exe命令测试Azure Redis的性能
【Azure Redis 缓存 Azure Cache For Redis】使用Redis自带redis-benchmark.exe命令测试Azure Redis的性能
|
12天前
|
网络协议 测试技术 网络安全
Python进行Socket接口测试的实现
在现代软件开发中,网络通信是不可或缺的一部分。无论是传输数据、获取信息还是实现实时通讯,都离不开可靠的网络连接和有效的数据交换机制。而在网络编程的基础中,Socket(套接字)技术扮演了重要角色。 Socket 允许计算机上的程序通过网络进行通信,它是网络通信的基础。Python 提供了强大且易于使用的 socket 模块,使开发者能够轻松地创建客户端和服务器应用,实现数据传输和交互。 本文将深入探讨如何利用 Python 编程语言来进行 Socket 接口测试。我们将从基础概念开始介绍,逐步引导大家掌握创建、测试和优化 socket 接口的关键技能。希望本文可以给大家的工作带来一些帮助~
下一篇
DDNS