A solution for this issue is to serve only pre-compressed .br file and disable "compress-on-the-fly" in brotli conf:
brotli off; # turn off compress-on-the-fly
brotli_static on; # serve existing pre-compressed br file
brotli_comp_level 11;
To compress html, js, css files, install brotli with:
apt install brotli
and use this command to brotli all html, js, css files in cache directory:
#!/bin/bash
for f in $(find /var/www/DOMAIN/htdocs/wp-content/cache/ -name '.html' -or -name '.css' -or -name '*.js'); do brotli -Z -v -f $f; done
CPU high useage is fixed and nginx is serving pre-compressed .br files.