Giter Club home page Giter Club logo

Comments (4)

jeckleee avatar jeckleee commented on June 2, 2024

我刚刚使用本地redis服务试了一下:

//代码
for ($i = 1; $i < 200; $i++) {
Redis::get('aa');
}
return response('ok');

//8进程压测
Concurrency Level: 100
Time taken for tests: 8.637 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 122000 bytes
HTML transferred: 2000 bytes
Requests per second: 115.78 [#/sec] (mean)
Time per request: 863.724 [ms] (mean)
Time per request: 8.637 [ms] (mean, across all concurrent requests)
Transfer rate: 13.79 [Kbytes/sec] received

我这个是本地redis,你要不是本地redis,成绩肯定会更差.

from webman.

zwfec avatar zwfec commented on June 2, 2024

我刚刚使用本地redis服务试了一下:

//代码 for ($i = 1; $i < 200; $i++) { Redis::get('aa'); } return response('ok');

//8进程压测 Concurrency Level: 100 Time taken for tests: 8.637 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 122000 bytes HTML transferred: 2000 bytes Requests per second: 115.78 [#/sec] (mean) Time per request: 863.724 [ms] (mean) Time per request: 8.637 [ms] (mean, across all concurrent requests) Transfer rate: 13.79 [Kbytes/sec] received

我这个是本地redis,你要不是本地redis,成绩肯定会更差.

是的, 这个测试是 mac 下 docker 里的 redis server

测试过当前机器的redis server, 基本可以到 Requests per second: 220+ [#/sec] (mean)

from webman.

walkor avatar walkor commented on June 2, 2024

Redis很快,但是也有极限,普通服务器的Redis的QPS最高就大概10万QPS左右。
每个请求200次redis访问,10W/200 = 500QPS,所以这种200次Redis访问的业务任何语言、任何框架压测出来结果都是几百,没什么好聊的。

还有压测上正常linux服务器,不要用docker或虚拟机。压测记得加-k,否则很容易本地端口用光导致延迟影响结果。
这种巨慢的业务压测最好把 config/server.php里的reuse_port打开,让连接均摊到每个进程。

以下是4核4G腾讯轻量服务器压测结果
webman的
image

php-fpm的
image

from webman.

zwfec avatar zwfec commented on June 2, 2024

Redis很快,但是也有极限,普通服务器的Redis的QPS最高就大概10万QPS左右。 每个请求200次redis访问,10W/200 = 500QPS,所以这种200次Redis访问的业务任何语言、任何框架压测出来结果都是几百,没什么好聊的。

还有压测上正常linux服务器,不要用docker或虚拟机。压测记得加-k,否则很容易本地端口用光导致延迟影响结果。 这种巨慢的业务压测最好把 config/server.php里的reuse_port打开,让连接均摊到每个进程。

明白了, 谢谢!
使用 golang 压了一下, mac 下没有相关配置优化的情况下, 效果也差不多:

本机redis 的 QPS 大概情况:
image

golang下的压测情况:
image

from webman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.