Major new features
Redis/PDO/MySQLi support
From4.1.0
Version began to support the rightPHP
NativeRedis
、PDO
、MySQLi
The support of coordination.
AvailableSwoole\Runtime::enableCorotuine()
Blocking common synchronizationRedis
、PDO
、MySQLi
Asynchronous Non-blocking with Operations Becoming Coordinated SchedulingIO
Swoole\Runtime::enableCoroutine();
go(function () {
$redis = new redis;
$retval = $redis->connect("127.0.0.1", 6379);
var_dump($retval, $redis->getLastError());
var_dump($redis->get("key"));
var_dump($redis->set("key", "value"));
$redis->close();
});
Concorde tracking
The new version adds two methods to track coordinated operation.
-
Coroutine::listCoroutines()
It can traverse all current synergetic processes. -
Coroutine::getBackTrace($cid)
A function call stack that can obtain a certain coordination
function test1() {
test2();
}
function test2() {
while(true) {
co::sleep(10);
echo __FUNCTION__." \n";
}
}
$cid = go(function () {
test1();
});
go(function () use ($cid) {
while(true) {
echo "BackTrace[$cid]:\n-----------------------------------------------\n";
//Return array, need self-print format
var_dump(co::getBackTrace($cid))."\n";
co::sleep(3);
}
});
BackTrace[1]:
-----------------------------------------------
#0 Swoole\Coroutine::sleep(10) called at [/home/htf/workspace/swoole/examples/coroutine/backtrace.php:8]
#1 test2() called at [/home/htf/workspace/swoole/examples/coroutine/backtrace.php:3]
#2 test1() called at [/home/htf/workspace/swoole/examples/coroutine/backtrace.php:14]
Other amendments
- Reconstruction
Co\Channel
The underlying code of C is C++, which solves unexpected results of complex scenes and realizes high stability. - Reconstruction
Co\Http\Client
The underlying code of C is C++ synergetic mode, which solves the asynchronous timing problem and realizes high stability. - Support for use in coordination and Server
exit
At this point, the catch will be thrown\Swoole\ExitException
abnormal - Remove PCRE dependency restrictions for all iterators (table/connection/coroutine _ list)
- Increase
open_websocket_close_frame
Configuration, close frame can be received in onMessage event - Abandoned
Http\Response->gzip()
Method, use insteadhttp_compression
Configuration item. The bottom layer will automatically judge the incoming from the clientAccept-Encoding
Select the appropriate compression method and add Google BR compression support. - Increase
Co\Http\Client->addData()
Method, data in memory can be sent as uploaded file content -
Solaris
system support - Http2 support
MAX_FRAME_SIZE
Framing andMAX_HEADER_LIST_SIZE
Processing, client increaseisStreamExist
The method detects whether there is a corresponding flow -
swoole_http_response->status
Increasereason
Parameter - Fix the problem of numeric overflow caused by unsigned parameters using signed values in MySQL prepare
- Repair HTTP2′ s
onRequest
There is no coordination problem in the callback. - Repair
tasking_num
Under certain special circumstances, it becomes-1
The problem of - Fix window-update frame construction error for HTTP2-server
- Fix all levels of compilation warning under all PHP versions
- Compilation errors will occur when GCC version is less than 4.8
- Fixes memory allocation increasing due to MySQL not using parameter binding when using prepare
- Repairing Old stream Memory Loss Leakage During HTTP2 Reconnection
Related to bottom-level development
- Uniform file naming#970
-
Co\Http\Client
Usedcreate_obj
Andfree_obj
Ensure memory security and prevent incorrect PHP code from causing memory problems