OpenSwoole Memory Management

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

OpenSwoole provides 6 different memory operation APIs: Lock, Buffer, Table, Atomic, MMap, Channel which can be used when developing multiple process programs.

All these API are async and non-blocking, multiple-process safe. Don't have to warry about the data sync issues.

OpenSwoole Table

OpenSwoole table is a high performance memory management module, implemented based on shared memory and spin lock. It is shared with multiple corotuine processes, can be used to store application level variables.

OpenSwoole Atomic

Integer variable allows any processor to atomically test and modify. Implemented based on CPU atomic instructions.

OpenSwoole Lock

OpenSwoole locks enable PHP developers use locks for data synchronization between multiple theads or processes. It is not supported within the Coroutine context.

OpenSwoole Buffer (Depreciation)

Memory management module enable developers managing memory like C language without worrying about memory allocation, release.

OpenSwoole MMap (Depreciation)

OpenSwoole provides the api to use mmap for files access.

OpenSwoole Channel (Depreciation)

Memory data structure likes Chan in Golang, implemented based on shared memory and Mutex locks. It can be used as high performance message queue in memory.

Last updated on September 1, 2022