- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- 复制
- 微信扫一扫分享
- 已成功复制到剪贴板
PHP常驻进程编程需知 郭新华 PHPCON2019
随着Swoole这些PHP常驻进程的技术方案兴起,我们PHPer可以做越来越多的事情,比如高性能的微服务、物联网、IM、直播等等,但是传统的web开发和Swoole下的常驻进程模式开发是有很多区别的,本演讲将从内存、阻塞、性能分析等角度阐述传统PHPer需要提升的技术点以及一些常用的工具。
展开查看详情
1 .PHP —
2 .PHPCon PPT https://github.com/ThinkDevelopers/PHPConChina PPT PHPCon
3 .PHP https://segmentfault.com/a/1190000012028295
4 . PHP PHP is a popular general-purpose scripting language that is especially suited to web development.
5 .PHP /C/C++ nginx java/c#/go service AI PHP or
6 . PHPer 1. 2. 3. 4. 5.
7 .1.
8 .PHP vars tmps args str_repeat vars tmps args foo
9 .1 2 3
10 .PHP or opcache
11 .PHP unset null
12 . $var 0 refcount 0 • composer gc_disable() 10000 • gc • gc_disable()
13 .FPM —php_request_shutdown array object string heap/stack zval function class_entry extensio PHP emalloc/efree* RSHUTDOWN=> php_request_shutdown zend MM emalloc*(ext efree gc_disable() ) operate system
14 . php_request_shutdown 1.max_request (1) (base ) (2) (3) (4) (opcache,ext minits) 2. unset
15 .• unset
16 .
17 .
18 .—
19 .—FPM swoole
20 . 2. mysql PHP (e.g php7_warpper) :
21 . —FPM FPM worker accept worker worker master prefork worker worker worker close
22 . —Swoole swoole(base) accept worker worker worker master prefork worker reactor worker worker close
23 .
24 . strace -p 123456 lsof -p 123456 fd strace PHP
25 .swoole/FPM ptrace
26 .mysql
27 .profile —Xhprof
28 . profile profile PHP PHP
29 .c profile —callgrind https://www.bo56.com