栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > PHP

SWOOLE 从入门到放弃之写个小框架(二十一)

PHP 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

SWOOLE 从入门到放弃之写个小框架(二十一)

小框架的代码从一开始就尽量使用单例模式,它的优点就是不会被重复多次实例化。能减少内存滥用。在关闭enable_static_handler后,控制器输出 hello,word
VBOX+CENTOS7 CPU 4CORE MEM 5G

ab -c 100 -n 30000 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 3000 requests
Completed 6000 requests
Completed 9000 requests
Completed 12000 requests
Completed 15000 requests
Completed 18000 requests
Completed 21000 requests
Completed 24000 requests
Completed 27000 requests
Completed 30000 requests
Finished 30000 requests

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

document Path:   /
document Length: 46 bytes

Concurrency Level:      100
Time taken for tests:   2.330 seconds
Complete requests:      30000
Failed requests: 0
Write errors:    0
Total transferred:      5820000 bytes
HTML transferred:1380000 bytes
Requests per second:    12874.83 [#/sec] (mean)
Time per request:7.767 [ms] (mean)
Time per request:0.078 [ms] (mean, across all concurrent requests)
Transfer rate:   2439.18 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect: 0    1   0.7      17
Processing:     1    7   3.1      6      69
Waiting: 0    7   3.1      6      69
Total:   2    8   3.1      7      72

Percentage of the requests served within a certain time (ms)
  50%      7
  66%      8
  75%      8
  80%      9
  90%     10
  95%     11
  98%     14
  99%     18
 100%     72 (longest request)

代码没有优化,只是在写代码时就比较注意。AB压测通达到12K,超出了当时设定的10K。

阶段性的开发算是完成了。接下来,在小框架的机基上编写一个简单的IM项目。有兴趣的小伙伴可以继续关注。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/228982.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号