Replies: 4 comments
-
Should I use Swow in production?Swow now have basic stability, and proven to be work stably (via continuous tests / phpbc). Now, swow is in release, API/ABI changes will follow semantic version changes. related:#81 (comment) #88 #105 #120 cURL hook on Windows: stuck, crash with Swow curl hookphp_curl.dll from official PHP distribution have statically linked aginst libcurl, the cURL symbols in it are not exposed, to use them, Swow needs to link against cURL statically also. When the official PHP distribution updates cURL, the newer cURL symbols in php_curl.dll will mismatch the older ones in php_swow.dll, this may cause strange bugs like stuck and crash. Since 1.5.0 cURL hook is fully ported, this should fix related issues, update swow to 1.5.0+ may work How to statically link Swow into PHP ?You can use https://github.com/crazywhalecc/static-php-cli https://github.com/dixyes/lwmbs We call building an extension with PHP in PHP directory tree an "in-tree build" (this concept is stolen from kernel), in-tree build can make Swow into PHP binary. related: #119 Does Swow support some OS ?Swow's OS requirements are based on libuv requirements, see libuv supported platforms. Common frameworks Swow supportknown info (remind me to update this): hyperf: swow-skeleton Is Swow compatible with Swoole?No, both Swow and Swoole provide similar facilities, their API is not compatible, Swow and Swoole cannot be loaded at the same time, if you need a PHP binary with Swoole in Windows, consider swoole-cli, wsl, virtual machines, docker desktop, cygwin, vagrant related: #85
|
Beta Was this translation helpful? Give feedback.
-
今年能发布正式版吗? 如果能大概几月出来,之前b站看了直播说今年有望发布1.0正式版十分期待,同时期待一手swoole(swow) 合体 |
Beta Was this translation helpful? Give feedback.
-
希望能合入php-src |
Beta Was this translation helpful? Give feedback.
-
swow 和 swoole 的关系: PPT 第23页: |
Beta Was this translation helpful? Give feedback.
-
什么时候可以正式使用?
Swow目前的代码稳定性已经实现了基本保证(通过CI测试 / phpbc),可以保证稳定运行。
为了形成良好的API/ABI设计,Swow目前不保证API/ABI的稳定性,API/ABI的使用方式可能随时更改而不进行额外通知。可以根据你的项目具体要求决定是否应该使用Swow。目前Swow已经进入release阶段,API/ABI稳定性根据语义版本号变更。
相关:#81 (comment) #88 #105 #120
Windows下cURL hook问题:使用Swow curl hook的程序崩溃,卡死
Windows下PHP官方发行包中cURL被静态编译到php_curl.dll,并未暴露cURL的符号,为了使用cURL的功能,Swow也需要静态链接cURL库,当官方发行包更新cURL版本后,使用新版本cURL的php_curl.dll和使用旧版本cURL的php_swow.dll中的cURL ABI不匹配,这会导致一些奇怪的现象:包括但不限于程序运行缓慢,运行时崩溃,卡死,无法正常退出等。目前1.5.0版本已经实现了完整的cURL hook,应当已经修复此问题,更新到1.5.0+的版本来修复这个问题
相关: #65 #68 #100 #233
如何静态编译Swow到PHP
可以使用https://github.com/crazywhalecc/static-php-cli https://github.com/dixyes/lwmbs
可以从 https://bin.dixyes.cn 下载编译好的单文件php二进制 (mainland China users only, this will be very slow for other users)
我们称呼在PHP目录树下直接同时构建PHP和Swow为in-tree构建(从Linux内核那偷的概念),in-tree构建可以将Swow静态连接到php中。
Swow的构建系统支持in-tree构建,如果执行in-tree构建失败了,请反馈bug。(TODO:写具体怎么做的文档)
相关:#119
Swow兼容某某系统吗?
Swow对操作系统的兼容性主要受到libuv的限制,见libuv支持平台。
简单来说:Linux>=2.6.32 macOS>=10.15 Windows>=8 FreeBSD>=10 NDK>=r15b (Android 7.0)
相关:#107 #125
各种框架对Swow的支持如何?
相关信息(提醒我定期更新一下):
hyperf: swow-skeleton
mix-php: api-skeleton
workerman: walkor/workerman#763
相关:#62 #115
Swow是否兼容Swoole
并不,Swow和Swoole提供了类似的设施,Swow和Swoole的PHP API不互相兼容,不能同时加载Swow和Swoole,如果你需要一个Windows下的Swoole,考虑使用swoole-cli,wsl,虚拟机,docker desktop,cygwin等手段
相关:#85
sleep()
msleep()
usleep()
Channel->pop($timeout)
等超时提前返回当工作负载中存在一些长CPU阻塞时,可能会发生各种睡眠/超时提前返回的现象,这是libuv的事件机制决定的,暂时没有不牺牲调度器性能的缓解方案。
如果需要高精度的延时,可以考虑使用
Watchdog
对象来强制进行事件调度,具体的使用方法参考 #160 相关讨论。StackOverflow上的相关信息:https://stackoverflow.com/questions/42315493/why-is-libuv-timer-drifting
相关:#160
IDE 提示
Composer包中包含了Swow扩展的stub文件,通过安装swow/swow包即可为支持的IDE(PHPStorm、intephlense或者其他支持phpdoc的IDE)提供提示
相关:#164
为什么协程一运行就退出了
需要在底下 sleep 一段时间,或者使用其他更可靠的同步机制,详见:Swow - 为什么协程一运行就退出了
相关:#206 #169
Beta Was this translation helpful? Give feedback.
All reactions