compression

zlib acceleration

With the z15 the CPU in System Z has gotten the ability to compress data into the zlib format really fast. The feature is officially called Integrated Accelerator for zEnterprise Data Compression (zEDC). This is know as zlib acceleration. Of course decompression is also faster, but the vast amount of CPU resources is usually spent in compression. I’ve been using this feature now for a year and I really like it. For a tar -czf ... you get a really fast response.  

As this is a new user space instruction, the only thing you need from an operating system perspective is the z15 enablement. The same is true for z/VM and KVM. As soon as they support the new CPU model the instruction is available. For container environments, the instruction is available if it’s available for the Linux image running the container. 

To enable this you need one of the supporting distributions. There is an environment variable controlling which compression levels should be accelerated. The environment variable DFLTCC_LEVEL_MASK contains a binary value. Here are a few examples:

  • DFLTCC_LEVEL_MASK=0x0000 (disable hardware acceleration)
  • DFLTCC_LEVEL_MASK=0x0002 (enable hardware acceleration for compression level 1)
  • DFLTCC_LEVEL_MASK=0x0003 (enable hardware acceleration for compression level 0 and 1)
  • DFLTCC_LEVEL_MASK=0x007f (enable hardware acceleration for compression level 0-6)
  • DFLTCC_LEVEL_MASK=0x01ff (enable hardware acceleration for compression level 0-8)

Note that the compression ratio will not change by this setting! The ratio will always be roughly the same as compression level 1. My recommendation is to use 0x01ff as this will speed up every level but the one with the best compression ratio. So if a software intentionally calls compression level 9 to achieve optimal compression it will get it.

Java has z15 support of zlib acceleration starting with Java 8 SR6. It automatically detects the new hardware and uses it. The OpenJDK variants (at least the jdk-11.0.6+10 that I tried) uses the system zlib. So you need a supporting distribution with the right environment setting to exploit. 

As there are slight distribution specific differences, I’ll list them in detail below for the supported distributions. This section will grow as more and more distributions will pick up the support.

RHEL 7.7

No support of the zlib yet but Java 8 SR6 already works.

RHEL 8.1

No support of the zlib yet but Java 8 SR6, already works. Red Hat also included gzip and gunzip support. If you don’t want to set the environment variable at every login, you can add a line like

export DFLTCC_LEVEL_MASK=0x01ff

to /etc/bashrc. Then it’s enabled for every user. Of course everyone can include it in their own .bashrc

SLES 12 SP5

SUSE has put the exploitation into the popular gzip and gunzip commands as well as in the standard libz. If you don’t want to set the environment variable at every login, you can add a line like

export DFLTCC_LEVEL_MASK=0x01ff

to /etc/bash.bashrc.local. Then it’s enabled for every user. Of course everyone can include it in their own .bashrc

SLES 15 SP1

SUSE has released the zlib library (libz1-1.2.11-3.9.1.s390x).  If you don’t want to set the environment variable at every login, you can add a line like

export DFLTCC_LEVEL_MASK=0x01ff

to /etc/bash.bashrc.local. Then it’s enabled for every user. Of course everyone can include it in their own .bashrc

(updated 2/10/2020)

Leave a Comment

Your email address will not be published.