laravel5.2、thinkphp5、thinkphp3.2.3性能AB测试

测试使用同一台机器、同一个数据库,同一个表,发现laravel语法和tp5语法相似度极高,而且性能也差不多,从数据上看tp5性能比laravel高一点点,但还没tp3高

请求5000次,并发200 laravel

Requests per second:    1655.54 [#/sec] (mean)每秒请求数(平均)越大越好
Time per request:       120.807 [ms] (mean)每次并发请求时间越小越好
Time per request:       0.604 [ms] (mean, across all concurrent requests)每次并发请求时间越小越好

thinkphp5

Requests per second:    1697.69 [#/sec] (mean)每秒请求数(平均) 越大越好
 Time per request:       117.807 [ms] (mean)每次并发请求时间 越小越好
 Time per request:       0.589 [ms] (mean, across all concurrent requests))每次并发请求时间 越小越好

laravel代码

模型



class DocumentArticle extends Model
{
    protected $table = 'document_article';
    //
}

控制器


class IndexController extends Controller
{
    public function index(){

       $list =  DocumentArticle::all();


        return view('index', ['list' => $list]);
    }

}

视图

@foreach ($list as $user)
   {{ $user->id }}:{!! $user->content !!}
@endforeach

测试结果

Server Software:        Apache/2.4.17
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /laravel/public
Document Length:        340 bytes

Concurrency Level:      200
Time taken for tests:   0.604 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      597000 bytes
HTML transferred:       340000 bytes
Requests per second:    1655.54 [#/sec] (mean)
Time per request:       120.807 [ms] (mean)
Time per request:       0.604 [ms] (mean, across all concurrent requests)
Transfer rate:          965.19 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:    33  107  17.7    113     131
Waiting:       33  107  17.6    113     131
Total:         34  108  17.7    114     131

Percentage of the requests served within a certain time (ms)
  50%    114
  66%    115
  75%    115
  80%    116
  90%    118
  95%    121
  98%    124
  99%    127
 100%    131 (longest request)

thinkphp5代码

模型



class DocumentArticle extends Model
{

}

控制器


class Index extends Controller
{
    public function index()
    {
        $list = DocumentArticle::all();
        $this->assign('list',$list);
        return $this->fetch('index');
    }
}

视图

{volist name="list" id="vo"}
{$vo.id}:{$vo.content}<br/>
{/volist}

测试结果

Server Software:        Apache/2.4.17
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /tp5/public
Document Length:        336 bytes

Concurrency Level:      200
Time taken for tests:   0.589 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      589000 bytes
HTML transferred:       336000 bytes
Requests per second:    1697.69 [#/sec] (mean)
Time per request:       117.807 [ms] (mean)
Time per request:       0.589 [ms] (mean, across all concurrent requests)
Transfer rate:          976.51 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:    33  106  17.5    110     132
Waiting:       33  106  17.5    110     132
Total:         34  106  17.5    110     133

Percentage of the requests served within a certain time (ms)
  50%    110
  66%    115
  75%    117
  80%    118
  90%    120
  95%    121
  98%    124
  99%    127
 100%    133 (longest request)
 

thinkphp3.2.3表现不错

Server Software:        Apache/2.4.17
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /onetk
Document Length:        331 bytes

Concurrency Level:      200
Time taken for tests:   0.528 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      579000 bytes
HTML transferred:       331000 bytes
Requests per second:    1893.83 [#/sec] (mean)
Time per request:       105.606 [ms] (mean)
Time per request:       0.528 [ms] (mean, across all concurrent requests)
Transfer rate:          1070.83 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       2
Processing:    27   95  15.5     99     121
Waiting:       27   94  15.5     98     121
Total:         28   95  15.5     99     121

Percentage of the requests served within a certain time (ms)
  50%     99
  66%    100
  75%    100
  80%    101
  90%    108
  95%    112
  98%    117
  99%    119
 100%    121 (longest request)

转载于:https://my.oschina.net/u/1256221/blog/676631

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值