为了账号安全,请及时绑定邮箱和手机立即绑定

SWOOLE 从入门到放弃之写个小框架(三)

标签:
PHP

今天这里立一个FLAG,框架开发完成后,要求性能必须保证10K/QPS,记住,是10K,不是1000。如果达不到要求,嘿嘿。推翻重写。一定要写出来。。

测试HTTP DEMO
环境:VBox Centos 7 CPU 4核,内存4G
AB:ab -c 100 -n 100000 http://127.0.0.1:9501/

This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests

Server Software:        swoole-http-server
Server Hostname:        127.0.0.1
Server Port:            9501

Document Path:          /
Document Length:        5 bytes

Concurrency Level:      100
Time taken for tests:   2.833 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      15200000 bytes
HTML transferred:       500000 bytes
***Requests per second:    35301.06 [#/sec] (mean)***
Time per request:       2.833 [ms] (mean)
Time per request:       0.028 [ms] (mean, across all concurrent requests)
Transfer rate:          5240.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.3      1       3
Processing:     0    2   0.7      2      12
Waiting:        0    1   0.7      1      12
Total:          1    3   0.7      3      14

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      3
  75%      3
  80%      3
  90%      3
  95%      3
  98%      4
  99%      5
 100%     14 (longest request)

是不是很惊讶,这里能达到30K+,为什么定的目标是10K?其实这是有原因的。这个屁都没加载一个,能不快吗。MVC框架,必须能满足MODEL--CONTROLLER--VIEW等等内容,还要有路由,加载器,配置,日志,钩子,任务等功能。不然就不算是一个比较完整的框架。

再说明一点,只是写一个小框架,并不一定能满足生产环境需求,后续坚持写完后也仅供小伙伴把玩研究,您就是反玩到包浆,也跟我没关系。嘿嘿

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消