Swoole 4.4 official version has been released, this version includes a large number of updates, details are as follows:
Down incompatible changes
- And
PHP
official consistent, no longer supportedPHP7.0
(@matyhtf) - Remove the
Serialize
module, in a separate ext-serialize maintenance extension abandoned reason: BecausePHP
the kernel change frequently, making it impossible to achieve a stable available modules, andphp serialize
compared to no significant differences in localization - Remove the
PostgreSQL
module, in a separate ext-postgresql maintenance extension abandoned reason:PostgreSQL
the use of asynchronous callbacks way to achieve coroutine scheduler, the kernel does not comply with the current unified planning of coroutines. In additionPostgreSQL
the current user is very low, and the lack of necessary unit testing to ensure quality Runtime::enableCoroutine
No longer automatically compatible coroutine internal and external environment, once opened, all the blocking operation must call (@matyhtf) in Coroutine-
Since the introduction of a new coroutine
MySQL
client-driven, low-level design more standardized, but there are some small downward incompatible changefetch/nextResult
Optimized for read on demand, will produce IO scheduling- Start
defer
time characteristics,statement
the request issued, it is necessary to usestatement->recv
the reception - Start
defer/fetch_mode
time characteristic, if the received data is not completed, will not initiate a new request - Unlike asynchronous,
connected
property will no longer be updated in real time based on the event, butIO
after the update operation fails
Deprecation warnings
- The waste
Buffer
module discarding reasons: substitutability strong, low utilization rate, availablePHP
string,fopen("memory")
in place. - The waste
Lock
module discarding reasons: there may be a problem in the coroutine mode locking, may be usedchan
to achieve lock release coroutine - Since the introduction of
stream_socket_pair
co-phased, it is recommended when the hook is turned on, if a separate configuration requirements, use theSWOOLE_HOOK_STREAM_FUNCTION
constant instead ofSWOOLE_HOOK_STREAM_SELECT
New features
-
New
Library
, purePHP
write a kernel function insteadC/C++
, it offers the following features- New high quality
PHP
modulesCoroutine\WaitGroup
(@twose) - Using the
PHP
code to achieve the CURL Hook, a key to CURL coroutine of the current experimental characteristics, require special callRuntime::enableCoroutine(SWOOLE_HOOK_CURL)
to open (@matyhtf) (@Yurunsoft) - Using the
PHP
code to achieveexec
/shell_exec
coroutine of (# 2657) (@Yurunsoft) - Open
RuntimeHook
, it will replace the functionarray_walk
,array_walk_recursive
version swoole implemented to address the primary function non-reentrant problem, but the cause could not traverse the object (@matyhtf) (@twose)
- New high quality
- Add coroutine preemptive scheduling, a coroutine prevents CPU time is too long cause other coroutine starvation, by
php.ini
configurationswoole.enable_preemptive_scheduler = On
open, see relevant examples preemptive_scheduler (@shiguangqi) - New
Timer::list()
returnTimer\Iterator
, can traverse all timer,Timer\clearAll
clear all timers,Timer\info(int $id)
get timer information,Timer::stats()
obtain the global timer status (# 2498) (@twose) - Add
Co\Socket
two methodsgetOption
andsetOption
(9d13c29) (@matyhtf) - Add
Process\Pool
the$master_pid
properties andshutdown
methods (a1d6eaa) (@matyhtf) - New
Process\Pool
fourth parameter configuration method, the underlayer is true automaticallyonWorkerStart
callback open coroutine (8ceb32cd) (@matyhtf) - New
stream_socket_pair
co-phased support (# 2546) (@matyhtf) - Add
Http\Server
thestatic_handler_locations
settings, you can set a static file path (@matyhtf) - New
Co\Http\Client->setBasciAuth
method for automatically transmittingAuthorization
head (# 2542) (@hongbshi) - New
Co\Http2\Client->ping
method (40041f6) (@shiguangqi) - New
hook_flags
configuration items used to replace theRuntime::enableCoroutine()
function call
Increase
-
The new coroutine
MySQL
client-driven, bottom round co-phased (# 2538) (@twose)- Use bottom
C++
and coroutine program mode (synchronous blocking writing, asynchronous performance) - It supports SSL connections (when disposed connect
['ssl' => true]
to, certificates and other configurations not supported) - Large data transmission support (no upper limit, automatic spell package bottom, the upper limit is the upper limit MySQL server configuration)
- Support large data reception
- Support
fetch
by line reading (nowfetch
to read on demand, did not fetch the data will not consume user memory) ( # 2106 ) - Support
nextResult
read-demand (ibid) - The client
close
, the client holdsstatements
automatically become unavailable, avoid border problems - (When the protocol analysis) optimized away some unnecessary memory copy
date
Related types support decimal precision- Error codes and information
PDO
/mysqli
consistent
- Use bottom
Co\Redis
Compatibility mode, the$redis->set(['compatibility_mode' => true])
opening may be such thathmGet/hGetAll/zRange/zRevRange/zRangeByScore/zRevRangeByScore
the like returns, andphpredis
consistent (# 2529) (@ caohao- php)- The default allows
100K
a coroutine exist (c69d320b) (@twose) - Support
bailout
mechanisms (processes can quit properly when a fatal error occurs in the coroutines) (# 2579) (@twose) Server
Will show a friendly under the circumstances when an error occurs400/404/503
interface rather than no output (@matyhtf) (f3f2be9d)Server
Asynchronous restart feature is enabled by default security and automatic scheduling feature coroutine large data transmitted (# 2555) (9d4a4c47) (@matyhtf)Server
TheonFinish
callback support auto-negotiation process environment (@twose)Http
The client is enabled by defaultwebsocket_mask
, will no longer appear inexplicable Romwebsocket
problem (c02f4f85) (@twose)- No longer allowed in the outsourcing process
Channel
scheduling operation (519b6043) (@twose) WebSocket
Handshake disconnect (# 2510) (@twose) failure- In
Linux
the underlying case will automatically send a signal when the parent process to kill the child process exits abnormally (4b833a3d) (@matyhtf) - When the
Socket->recv
recovery end unwanted insufficient data length memory (642a3552) (@twose) - Floating-point calculation error optimization (# 2572) (@ tangl163)
- All built-in classes are prohibited cloning / disable serialization / delete prohibit attribute defines the bottom (f9c974b8) (@twose)
Server->bind
Inuid
more thanUINT32_MAX
when a warning is generated and returned- Compatible
PHP7.4
(# 2506) (@twose)
repair
- Fix
Process\Pool
thegetProcess
problem (# 2522) (@matyhtf) - Fix the problem in some special cases the exception is ignored (VM caught in a cycle of events and no chance of abnormalities) (@twose)
- In the process of restoration timer
fork
memory leak (8f3abee7) (@twose) produced after - The problem timezone repair non-Linux systems to compile (# 2584) (@devnexen)
- Repair
enable_coroutine
andtask_enable_coroutine
opening and closing of a problem (# 2585) (@matyhtf) - Http2 repair method does not output the trailer is empty head (# 2578) (@twose)
- Fix
Co\Http\Client->setCookies
memory errors (# 2644) (@Yurunsoft) in exceptional circumstances - Repair # 2639 (# 2656) (@ mabu233)
- Repair
arginfo_swoole_process_pool_getProcess
(# 2658) (@ mabu233) - Repair
static_handler
does not support soft link (@matyhtf) - Repair
OSX
Under stuck (22504dd4) (@matyhtf) - Fix to enable
SSL
thetask
process to useServer->getClientInfo
an error (# 2639) (@matyhtf) - Repair multi coroutine operations illegal operation of BUG same Socket (# 2661) (@twose)
Coroutine scheduler ?
- New
Swoole\Coroutine\Scheduler
scheduler class as thecli
entry of the command-line scripts, substitutedgo() + Swoole\Event::wait()
way - Increasing
Swoole\Coroutine\Run
function, to provideSwoole\Coroutine\Scheduler
a package go() + Swoole\Event::wait()
The operating mode may be abolished
Kernel
- Continued underlying code quality optimization (@swoole)
- More unit tests, and use based webmozart / assert assertion library secondary development from the swoole / the Assert (@twose)
- Completion memory allocation failure detection (b19bebac) (5a1ddad3) (@matyhtf)
- The complete abolition of
Windows
support programs - Some functions will be divided into coroutine finishing
System
orScheduler
module, repeal util module Co\Http2\Client
The bottom of the coroutine (f64874c3) (@matyhtf)- The underlying function fully cached information developers registered, the callback is invoked when faster (@twose)
Experimental content
- Possible in
5.0
newCo\Server
andCo\Http\Server
CURL Hook
(Not supportedcurl_multi
)