Dev
搜索

Dev

swoft 获取 容器 swoole_http_server 进程worker_id
发表于2019-03-08|php
获取容器123$con = Swoft\Bean\BeanFactory::getContainer();$app = $con->getBeanNames();return var_export($app,true); 通过BeanFactory类可以操作所有的bean通过以上方法可以获取所有的bean名 获取swool_http_server1234$http = Swoft\App::$server;$server = $http->getServer();$pid = $server->worker_pid;return var_export($pid, true);
windows 安装 wsl 跑 swoole swoft
发表于2019-03-07|php
打开wsl控制面板打开linux子系统 安装子系统在cmd里执行bash或者wsl即可,cmd提示需要安装,可以去商店安装,如果把删除了可以执行 1lxrun /install /y 他会自己下载 安装目录1C:\Users\YourName\AppData\Local\lxss\ 安装swoole从官网下载swoole的二进制包,然后执行加压 1tar -Jxf swoole-4.3.0.tar.xz 运行swoft使用完整的目录即可 1/home/bin/php /mnt/c/php/www/swoft/bin/swoft start
swoole 协程异步 带来的性能提升 压力测试
发表于2019-03-05|php
均访问同一cdn数据,模拟访问远程接口的情况 协程异步2009qps同步阻塞432qps协程压测12345678910111213141516171819202122232425262728Concurrency Level: 200Time taken for tests: 0.498 secondsComplete requests: 1000Failed requests: 0Total transferred: 209000 bytesHTML transferred: 19000 bytesRequests per second: 2009.49 [#/sec] (mean)Time per request: 99.528 [ms] (mean)Time per request: 0.498 [ms] (mean, across all concurrent requests)Transfer rate: 410.14 [Kbytes/sec] receive...
thinkphp beego swoft yaf 性能测试 压力测试 php go swoole 速度对比 helloworld
发表于2019-03-04|others
1ab -n 10000 -c 200 测试机为腾讯云1核1G普通云硬盘,如果用ssd的话php成绩会有所提升 输出内容为时间戳 beego swoft的性能都强的不得了,在同一级别,裸跑性能都逼近nginx处理静态文件nginx转发损耗很大,由于nginx转发会导致thinkphp,swoft,beego的性能几乎一样。所以有可能的话还是不要在这些框架外套个nginx了swoft+nginx:内存无波动,CPU占用81%swoft无nginx:内存无波动,CPU占用34% thinkphp+nginx41212345678910111213141516171819202122232425262728Concurrency Level: 200Time taken for tests: 24.256 secondsComplete requests: 10000Failed requests: 0Total transferred: 1940000 bytesHTML transferred: 190000 by...
swoft 开发的坑 路由不生效
发表于2019-03-04|php
自动重载代码失效根据实测,修改文件必须手动重启swoft,自动重载根本没有卵用
golang 导入包
发表于2019-03-04|golang
点操作有时候会看到如下的方式导入包 1import( . "fmt" ) 这个点操作的含义就是这个包导入之后在你调用这个包的函数时,你可以省略前缀的包名,也就是前面你调用的fmt.Println(“hello world”) 可以省略的写成Println(“hello world”) 别名操作12import( f "fmt" )f.Println("hello world") _操作说明只是为了执行包中的init函数
thinkphp beego swoft yaf 性能测试 压力测试 php go swoole 速度对比 数据读取
发表于2019-03-03|others
1ab -n 10000 -c 200 统一使用ab在200并发进行10000次请求 为更接近实际使用,用各自模型读取了一条数据 测试机为腾讯云1核1G普通云硬盘,如果用ssd的话php成绩会有所提升 用nginx做转发,会限制golang性能发挥,压测nginx静态页面大概2157qps 首先需要说明,swoft和beego在裸跑时,效率爆棚,几乎逼近处理静态文件,速度是thinkphp的6-7倍.增加nginx后有了较大耗损,差不多是thinkphp的1.7倍.受制于nginx和fpm,yaf这种框架也只是比thinkphp提升了一丢丢,实际意义已经不大 thinkphp+nginx253大部分请求都比较慢,但是基本上是0.8S左右 12345678910111213141516171819202122232425262728Concurrency Level: 200Time taken for tests: 39.601 secondsComplete requests: 10000Failed requests: 0Tota...
golang 类型转换
发表于2019-03-02|golang
转换为 字符串如果强制类型转换失败可以使用strconv包 1strconv.FormatBool(bool) 即可将bool转为str
nginx 访问某个目录转发到固定域名并去掉目录名
发表于2019-03-01|golang
123456789location /exhibition/ { index index.html index.htm; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://127.0.0.1:8080/; break;} 注意要点1location /exhibition/ 这个后一个斜线要加,否则请求到后端会多一个/ 1proxy_pass http://127.0.0.1:8080/; 这个后一个斜线要加,否则会带上目录名
golang 时间 格式化
发表于2019-03-01|golang
go格式化时间必须使用6-1-2-3-4-5这个时间点 时间戳1fmt.Println(time.Now().Unix()) 格式化1fmt.Println(time.Now().Format("2006-01-02 15:04:05")) 时间戳格式化1time.Unix(1389058332, 0).Format("2006-01-02 15:04:05") 时间解析1234the_time, err := time.Parse("2006-01-02 15:04:05", "2014-01-08 09:04:41")if err == nil { unix_time := the_time.Unix()} 其他操作12the_time := time.Date(2014, 1, 7, 5, 50, 4, 0, time.Local)unix_time := the_time.Unix()
1…313233…102
avatar
developer
AI相伴的开发者博客
文章
1016
标签
713
分类
31
Follow Me
公告
This is my Blog
最新文章
react native 0.83 turbo modules 安卓 使用记录2026-01-10
一种适合开发的设计风格2026-01-07
使用virtualbox 记录2026-01-04
ppa launchpad镜像2025-12-29
multipass 使用记录2025-12-28
分类
  • apicloud3
  • bootstrap8
  • cocos2d-js5
  • createjs17
  • day48
  • docker16
  • egret14
  • flash2x2
标签
对象 Typecho wordpress,plugins_url 一些也许有机会的事 本站2017年总结 算法 过滤目录和子目录下 删除失败 to [object Object] is_user_logged_in ftp helloworld 工作模式 索引 进一步说明 客户端等 关于工作的思考 centos scroll 分区编辑 控制台 opcache 解决方案 操作函数 cmd 微信 剩余参数 本地 获取真实 protected mysql_fetch_row nfs 常用算法 crontab 数据 is_singular ts 解决 gosublime
归档
  • 一月 2026 3
  • 十二月 2025 5
  • 十一月 2025 2
  • 十月 2025 5
  • 九月 2025 5
  • 八月 2025 2
  • 七月 2025 1
  • 五月 2025 1
网站信息
文章数目 :
1016
本站访客数 :
本站总浏览量 :
最后更新时间 :
© 2025 - 2026 By developer框架 Hexo 8.1.1|主题 Butterfly 5.5.4
搜索
数据加载中