What’s New in Swoole v6.0.0? Multithreading, iouring, and Core Optimizations Explained
Swoole v6.0.0 introduces multithreaded mode, new thread classes and synchronization primitives, iouring‑based asynchronous file I/O, numerous bug fixes, kernel optimizations, and deprecations, providing developers with enhanced performance, richer APIs, and broader platform compatibility for high‑concurrency PHP applications.
✨ New Features
Swoole now supports multithreaded mode; when PHP is built with ZTS, compile Swoole with --enable-swoole-thread to enable it.
Added thread creation class Swoole\Thread .
Added thread lock class Swoole\Thread\Lock .
Added atomic counters Swoole\Thread\Atomic and Swoole\Thread\Atomic\Long .
Added safe concurrent containers: Swoole\Thread\Map , Swoole\Thread\ArrayList , Swoole\Thread\Queue .
File asynchronous operations now use iouring as the underlying engine; enable with --enable-iouring after installing liburing . Functions such as file_get_contents , file_put_contents , fopen , fclose , fread , fwrite , mkdir , unlink , fsync , fdatasync , rename , fstat , lstat , and filesize are now asynchronous via iouring.
Boost Context upgraded to 1.84, enabling coroutine support on Loongson CPUs.
New methods: Swoole\Thread\Map::find() , Swoole\Thread\ArrayList::find() , Swoole\Thread\ArrayList::offsetUnset() , Swoole\Process::getAffinity() , Swoole\Thread::setName() , Swoole\Thread::setAffinity() , Swoole\Thread::getAffinity() , Swoole\Thread::setPriority() , Swoole\Thread::getPriority() , Swoole\Thread::gettid() .
Added Swoole\Thread\Barrier for multithread synchronization.
Added new cookie‑setting function.
Introduced a non‑blocking, re‑entrant mutex coroutine lock usable across processes and threads.
Swoole\Coroutine\Socket::getOption() now supports the TCP_INFO option.
Synchronous blocking client Swoole\Client now supports HTTP proxy.
Added asynchronous, non‑blocking TCP/UDP/Unixsocket client Swoole\Async\Client .
Optimized Swoole\Redis\Server::format() for zero‑copy memory handling and nested Redis structures.
Supported high‑performance compression with Zstd; compile Swoole with --enable-zstd to enable zstd compression for HTTP client/server.
🐛 Bug Fixes
Fixed PECL installation issues.
Fixed keep‑alive setting for Swoole\Coroutine\FastCGI\Client .
Resolved errors when max_input_vars is exceeded, preventing endless process restarts.
Fixed unknown issue caused by Swoole\Event::wait() in coroutines.
Fixed PTY support for proc_open in coroutine mode.
Fixed segmentation fault in pdo_sqlite on PHP 8.3.
Removed useless warnings during Swoole compilation.
Fixed errors when STDOUT/STDERR are closed (zend_fetch_resource2_ex).
Fixed invalid set_tcp_nodelay configuration.
Fixed occasional unreachable branch during file upload.
Fixed request method inconsistency when HTTP/2 is enabled.
Fixed incorrect content-type handling during file upload.
Fixed code errors in HTTP/2 coroutine client.
Fixed missing worker_id property in Swoole\Server .
Fixed Brotli configuration errors in config.m4 .
Fixed invalid Swoole\Http\Response::create in multithreaded mode.
Fixed compilation errors on macOS.
Fixed unsafe thread exit and static variable sharing issues in multithreaded mode.
Fixed fatal error caused by PHP 8.4 ZTS timeout feature.
Fixed exit() hook problems on PHP 8.4.
Fixed Swoole\Thread::getNativeId() on Cygwin.
Fixed SIGSEGV in Swoole\Coroutine::getaddrinfo() .
Fixed SSL enablement issue in runtime TCP module.
Fixed HTTP client timeout miscalculation during long runs.
Fixed mutex lock unusable after process exit for Swoole\Table .
Fixed named‑parameter issue causing Swoole\Server::stop() failure.
Fixed Swoole\Thread\Map::toArray() not copying keys, causing crashes.
Fixed inability to delete nested numeric keys in Swoole\Thread\Map .
⭐️ Kernel Optimizations
Removed unnecessary checks on socket structs.
Upgraded Swoole library.
Added support for HTTP 451 status code in Swoole\Http\Response .
Synchronized file operation code across different PHP versions.
Synchronized PDO operation code across PHP versions.
Optimized Socket::ssl_recv() implementation.
Improved config.m4 to set dependency locations via pkg-config .
Optimized request‑header parsing using dynamic arrays.
Improved file descriptor lifecycle handling in multithreaded mode.
Refined basic coroutine logic.
Upgraded CI testing to use a newer Oracle database version.
Optimized underlying sendfile logic.
Replaced PHP_DEF_HAVE with AC_DEFINE_UNQUOTED in config.m4 .
Optimized heartbeat, shutdown, and stop logic for server in multithreaded mode.
When glibc > 2.17, linking against librt is no longer required.
Enhanced HTTP client to accept duplicate request headers.
Optimized Swoole\Http\Response::write() and added HTTP/2 support.
Added compatibility for PHP 8.4.
Added asynchronous socket write capability.
Enabled shared native PHP socket in multithreaded mode.
Improved static file service and fixed path errors.
Async Server now supports restarting worker threads and starting timers in the Manager thread.
Added compatibility for PHP 8.4 curl extension.
Re‑implemented Swoole core to use iouring code.
Optimized timers to avoid reliance on signals.
Enhanced Swoole\Coroutine\System::waitSignal() to listen to multiple signals simultaneously.
❌ Deprecations
PHP 8.0 is no longer supported.
Swoole\Coroutine\MySQL client is deprecated.
Swoole\Coroutine\Redis client is deprecated.
Swoole\Coroutine\PostgreSQL client is deprecated.
Removed Swoole\Coroutine\System::fread() , fwrite() , and fgets() methods.
😊 Acknowledgements
Thanks to all contributors of Swoole v6.0.0 for their hard work and support.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
