Swoole 4.5.0

Swoole 4.5.0 is available! One thing that is not mentioned in the notes there is that the \Swoole\Server::getInstance() got removed as it was considered that not every code/library should have access to the Server instance. Instead now only the worker ID is available through \Swoole\Server::getWorkerId(). There is a bug though and this method can not…

Swoole 4.4.12 is out

Swoole jumped few versions from 4.4.8 to 4.4.12 but a lot of changes got in. including a fix allowing Swoole to work with PHP 7.4 Preload. The docker images I have are updated.

Performance comparison between Swoole and Apache/mod_php

I just finished a performance comparison between Swoole and Apache/mod_php (PHP 7.3) but not just in synthetic tests but tests that are closer to real world application. If you find a mistake or you would like to have anything added please create a Pull Request or let me know here in the comments. To view…

Connection Pools and resource management in Swoole

Introduction In this post I will explain the idea of resource pool and how it should be used. A resource pool is a limited pool from which a resource is obtained, used and then released back to the pool for other threads to use it. Usually these pools are actually connection pools so from now…

Coroutines in Swoole

Introduction In this post I will go through some details about the coroutines in Swoole (v4.0+). The first sections will explain the basics and certain details and then examples will be given. Numbers in [] refer to entries in the Notes section, while numbers in () refer to the Examples section. There are many links…

Swoole\Coroutine\System namespace in Swoole 4.4.6

In Swoole 4.4.6 the coroutine methods related to the filesystem, name resolution, and few others will be moved from Swoole\Coroutine to Swoole\Coroutine\System. The recommended way will be to access Co\System::sleep() instead of Co::sleep(). As a side note – here is a tool for dumping all Swoole classes. It is useful as the documentation is sometimes…

Swoole 4.4.4 is out

Swoole 4.4.4 was released on 17th. One thing that is not mentioned in the Release notes is that the Strict Mode is now deprecated. If used it produces the following message: Swoole\Runtime::enableStrictMode(): Swoole\Runtime::enableStrictMode is deprecated, it will be removed in v4.5.0