PHP 8.1 serializer vs igbinary serializer speed and memory usage

Created on 28 April 2023, about 1 year ago

Problem/Motivation

Hi

What performance results do you have after using igbinary with Drupal?

https://github.com/igbinary/igbinary

Igbinary is a drop in replacement for the standard php serializer. Instead of the time and space consuming textual representation used by PHP's serialize, igbinary stores php data structures in a compact binary form. Memory savings are significant when using memcached, APCu, or similar memory based storages for serialized data. The typical reduction in storage requirements are around 50%. The exact percentage depends on your data.

https://github.com/igbinary/igbinary/blob/master/benchmark/comparisons.php
https://speakerdeck.com/mamoot/drupal-and-php-performances?slide=14

We tried it on several sites and we didn't see any real improvement.
Details:
The sites have 100-400k nodes, all cached into Redis, Redis memory usage is between 500 MB - 4 GB. We switched the serializer for Redis, like here https://speakerdeck.com/mamoot/drupal-and-php-performances?slide=15
PHP: 8.1
igbinary version: 3.2.13
igbinary.compact_strings On On

Results

  • avg 1-5 % memory reduction
  • avg 5-20 % slower serialization/deserialization

Of course the serialization depends on the respective data, but probably a high number of Drupal sites are for content (lot of nodes with long full HTML content) and might not see a benefit after using igbinary.

Maybe other people can also share their results, maybe the mentioned comparison in articles was true for PHP 7.X, but it might not have the same benefits compared to the latest PHP version.

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Miscellaneous

Created by

πŸ‡·πŸ‡΄Romania zoltanb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024