Author Topic: Installing Brotli Module in Apache  (Read 143 times)

0 Members and 2 Guests are viewing this topic.

Offline
*
Installing Brotli Module in Apache
« on: May 01, 2019, 12:11:37 AM »
I was able to successfully install the Brotli module in Apache.

Now I would like to find out to make these changes permanent. I'm just worried that in the next update all my changes will disappear and I might have to edit files all over again.

I tried to look in the documentation but I could only find information on Vhosts templates, which is ok for part of the changes but not for all the changes.

For example, when compiling I would like to add the flag "--enable-brotli" permanently and in the file /usr/local/apache/conf/httpd.conf I would like to have the following lines uncommented:

LoadModule deflate_module modules/mod_deflate.so
LoadModule brotli_module modules/mod_brotli.so

Is there a way of doing this so the changes are permanent even when recompiling new versions of Apache?



Offline
*
Re: Installing Brotli Module in Apache
« Reply #1 on: May 01, 2019, 05:07:24 PM »
Hi,

Don't do it! Brotli is VERY BAD for performance! The compression ratio is improved compared to gzip, however the compression speed (i.e. how fast it can shrink say 100k into 10k) is QUADRUPLE that of gzip-6. That means, effectively, it takes FOUR times longer to send files from your web server to the end user.

Brotli works well for Google, who use Tilera accelerated CPUs to do the compression over lots of cores, but for everybody else using Nginx/Apache/Litespeed etc, stick to gzip.

In fact, if you want to get a speed improvement, you might consider dropping your gzip compression ratio from the default level of 6 down to 2. It sounds crazy because you're not compressing as low and therefore sending more data over the network, however the response time between gzip-6 and gzip-2 is almost halved.

Take a look at some Brotli benchmarks here: https://www.opencpu.org/posts/brotli-benchmarks/

In any case, to answer your question. If you did want to stick with Brotli, I'm afraid you'd have to reinstall the module every time you rebuild Apache using CWP.

Offline
***
Re: Installing Brotli Module in Apache
« Reply #2 on: May 02, 2019, 06:03:42 AM »
In fact, if you want to get a speed improvement, you might consider dropping your gzip compression ratio from the default level of 6 down to 2. It sounds crazy because you're not compressing as low and therefore sending more data over the network, however the response time between gzip-6 and gzip-2 is almost halved.
How can I do that?
In my site (Wordpress) I use W3 Total Cache to enable gzip. Any idea how I can lower it to level 2? Actually, I didn't even know there were compression levels at all...

Offline
*
Re: Installing Brotli Module in Apache
« Reply #3 on: May 15, 2019, 02:28:49 AM »
In fact, if you want to get a speed improvement, you might consider dropping your gzip compression ratio from the default level of 6 down to 2. It sounds crazy because you're not compressing as low and therefore sending more data over the network, however the response time between gzip-6 and gzip-2 is almost halved.
How can I do that?
In my site (Wordpress) I use W3 Total Cache to enable gzip. Any idea how I can lower it to level 2? Actually, I didn't even know there were compression levels at all...

Thanks for your great reply.

But even with gzip using mod_deflate, I'll still have the same problem I'm asking a solution for.
 
Everytime Apache gets recompiled I will have to uncomment

# LoadModule deflate_module modules/mod_deflate.so

Is there a way I can have an httpd.conf template?

Offline
*****
Re: Installing Brotli Module in Apache
« Reply #4 on: May 16, 2019, 08:20:51 AM »
Hi, just create /usr/local/apache/conf.d/deflate.conf with the code below:
Code: [Select]
LoadModule deflate_module modules/mod_deflate.so