swoole-1.8.0 release, asynchronous parallel C extension for PHP

Source: Internet
Author: User
Tags value store
The Swoole-1.8.0 version has been released, and this version is a milestone version, with new features, multiple core feature optimizations, and bug fixes and invalid removal features. The update reads as follows:

Client

    • Add native asynchronous MySQL Client

    • Increased native asynchronous Redis client, based on the Hiredis library that is officially provided by Redis

    • Adding native asynchronous Http clients

    • Increased native asynchronous WebSocket client Support

    • To refactor the underlying swclient, asynchronous TCP client implementations are placed into the Swoole kernel

    • Add Swoole_client->reuse property, Swoole_keep Connection in long connection mode to identify whether it is multiplexed

Server-side

    • Refactoring WebSocket Server code, the underlying and Length_check protocols reuse the same processing functions, enhancing stability

    • Added support for the Task process to the Tick/after timer, based on the high-precision setitimer+ signal implementation

    • Save the incoming host, port parameter to the Swoole_server object property in the constructor

    • Increased multi-port multiprotocol support (important update)

    • Add Swoole_server->defer function to delay execution of some functions

    • Add the option to force Swoole_server->close to disconnect, set the second parameter to true to empty the send queue and immediately disconnect the connection

Multi-Port Multiprotocol Example:

 $serv = new Swoole_server ("0.0.0.0", 9501); $port 2 = $serv->listen (' 127.0.0.1 ', 9502, swoole_sock_tcp); $port 2->set (' open_length_check ' = ' = ', ' package_length_type ' = ' N ', ' PA Ckage_length_offset ' + 0,//nth byte is the value of the packet length ' package_body_offset ' = 4,//The first byte begins to calculate the length ' Package_max_le  Ngth ' = 2000000,//protocol maximum length); $port 2->on (' Receive ', function (Swoole_server $serv, $FD, $from _id, $data) {echo "serverport2\n";}); $serv->on (' Connect ', function ($serv, $FD, $from _id) {echo "[#". Posix_getpid (). "] \tclient@[$FD: $from _id]: connect.\n ";}); $serv->on (' Receive ', function (Swoole_server $serv, $FD, $from _id, $data) {echo "[#". $serv->worker_id. "]    \tclient[$FD]: $data \ n ";    if ($serv->send ($FD, "hello\n") = = False) {echo "error\n"; }}); $serv->on (' Close ', function ($serv, $FD, $from _id) {echo "[#". Posix_getpid (). "] \tclient@[$FD: $from _id]: close.\n ";}); $serv->start (); 

Other

    • Adds swoole_table to the key value, which can be obtained when the foreach traverses the table

    • Change the key contrast mode of swoole_table, changing from CRC32 to direct string comparison

    • Update Utlist.h Library to 1.9.9 version

Swoole_table saving the key value will increase memory consumption, such as table size 1 million, the key value store will increase 64M memory consumption

Problem fix

    • Fix double-free issue after Message Queuing is enabled

    • Refactoring timer to fix the occasional core dump of after and tick timers

    • Timer using minimum heap data structure, insert/delete time complexity is log (N)

    • Fixed a problem where core dump occurred in Swoole_process::signal under PHP7

    • Fixed a problem where core dump occurred in Swoole_async_write under PHP7

Removing features

    • Remove unsupported feature-related legacy code, such as heartbeat_ping, Dispatch_key_type, etc.

    • Remove Swoole_server->addtimer, Swoole_server->deltimer, Swoole_server->gettimer

    • Remove Swoole_timer_add, Swoole_timer_del

    • Remove the OnTimer event from Swoole_server

    • Remove Task_worker_max configuration and related feature codes

    • Removing the Swoole_server->handler method

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.