The compressed serializers, serialization.igbinary_gz and serialization.phpserialize_gz, no longer compress every value. A new igbinary_compress_length setting defines the minimum length, in bytes, of the serialized data to compress. It defaults to 1000.
In addition, a value is now stored uncompressed whenever compressing it does not make it smaller.
Compressing short values costs CPU time for little or no gain. Below around 100 bytes, values usually get larger because of the zlib header and checksum. Up to around 1000 bytes, decompressing costs more than unserializing, for modest storage savings. See the profiling results in the issue and in #3014514.
Before
All values were compressed with zlib, whatever their size.
After
Only values of at least igbinary_compress_length bytes are compressed, and only when compression makes them smaller. The compression level is still set by igbinary_compress_level (default 1).
// In settings.php. The default is 1000.
$settings['igbinary_compress_length'] = 1000;
// Lower it to save more storage at the cost of more CPU time, or set it to 0
// to try to compress all values.
$settings['igbinary_compress_length'] = 100;
Existing data
No action is required. The serializers detect compressed values when reading them, so values stored before this change, compressed or not, remain readable. Changing igbinary_compress_length later does not require clearing caches or other stored data either.
Usage with the Redis cache backend
When using these serializers with the Redis cache backend, do not also enable the Redis module's own compression ($settings['redis_compress_length']). Values would otherwise be compressed twice, spending CPU time for no additional gain.
AI disclosure
Generated with the help of an LLM.