fbpx

Server Setup

Supercharge your CentOS/RHEL with faster zlib libraries by Intel and Cloudflare

by , , revisited on


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

zlib is a software library for data compression. It is so prominently used in open-source software, that it has become the crucial component of any Linux-based operating system.

The library dates its first public release back in the year 1995 and has received steady updates since then.

The standard zlib library aims the highest compatibility, and supports hardware from the 90’s.
But at the same time, it’s missing on many potential hardware optimizations of the modern platforms.

If your Linux workstation or server is relatively recent (e.g. 2009 and newer), you absolutely want to get your hands on the high-performance zlib forks by Intel and Cloudflare.

Users of the GetPageSpeed repository can quickly install either of the two as drop-in libraries to instantly speed up any compression workload on their machine, and thus improve performance in general.

How to install Intel’s fork of zlib library in CentOS/RHEL or Amazon Linux

sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
sudo yum -y install intel-zlib

Now, if you are running any service which performs compression, restart it. For example, restart a running instance of NGINX:

sudo service nginx restart

This step is only required for apps that make use of zlib, for them to load the high-performance version of the library.

To find out, which apps are still using the standard library, run:

lsof /usr/lib64/libz.so.1

If you find that currently, too many apps are using the standard lib, simply reboot to apply the faster library.

How to install Cloudflare’s fork of zlib library in CentOS/RHEL or Amazon Linux

The Cloudflare fork of zlib is based on zlib 1.2.8, so it’s not suitable for CentOS/RHEL 8 at this time.
All other operating systems (CentOS/RHEL 6,7 and Amazon Linux 2) can benefit from the faster compression:

sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm
sudo yum -y install cloudflare-zlib

Similarly, restart any service which makes use of the library.

Cloudflare vs Intel’s zlib?

Cloudflare’s zlib performance is better than Intel’s. But as noted above, Cloudflare’s zlib is not available as a drop-in library for CentOS/RHEL 8, just yet.

Both Intel and Cloudflare zlib perform marginally faster than the stock library.

Do you need both libraries?

No. Only one system version of zlib will apply. If you install both packages (Cloudflare and Intel), then the Cloudflare’s zlib will have priority.

A drop-in library co-exists with the standard library on your system. Applications that are linked against system zlib will make use of the installed drop-in library.

So simply installing either of the packages automatically improves compression speed throughout your system.

Did you like the drop-in approach for improving your system? Check out MozJPEG as drop-in replacement for libjpeg.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.