Brotli Compression is not working out of the box
Phoenix359 opened this issue · 4 comments
In order for Brotli Compression to work i had to add tags to the following line in the: applicationHost.xdt.
Old:
<scheme name="br" dll="%XDT_EXTENSIONPATH%\%XDT_BITNESS%\iisbrotli.dll" xdt:Transform="Insert" xdt:Locator="Match(name)" />
New:
<scheme name="br" dll="%XDT_EXTENSIONPATH%\%XDT_BITNESS%\iisbrotli.dll" dynamicCompressionLevel="4" staticCompressionLevel="11" xdt:Transform="Insert" xdt:Locator="Match(name)" />
I believe the default level is 0. For Brotli this means no compression,
but Gzip will compress with level 0.
According to the document, level 0 is "not compressed" with gzip, but brotli does "compress".
https://docs.microsoft.com/en-us/iis/extensions/iis-compression/using-iis-compression
It is difficult to pre-set the appropriate compression level. But gzip's behavior needs to be fixed.
Thx for the fast response!
I stand corrected. It is indeed compressed with Brotli only the level 0 of Brotli is not compressing as much as Gzip. Thats what triggered my post. (See file size example)
Original javascript file: 7.3 MB
Default Azure Gzip: 2.2 MB
IISCompressionExtension Gzip-1: 1.9 MB
IISCompressionExtension Brotli-0 : 2.3 MB
IISCompressionExtension Brotli-4 : 1.5 MB
IISCompressionExtension Brotli-11 : 1.1 MB
I see your point. Setting the optimal compression level for everyone is impossible, but i would expect Brotli to perform "better" then Gzip out of the box. What i have read about it so far suggest that for dynamic content the compression level is usually set somewhere between 4 and 7. You could also pick the lowest setting that would at least compress it as much as Gzip lvl 1 does.
I see you have fixed the Gzip behaviour for dynamicContent. What about the staticContent?
Is there an persistent way to configure the compression levels? Currently I set them manually in your applicationHost.xdt
but after an update these changes are gone. I have to remember to reapply them.
OK. I understood the problem. I commented on PR.
Thanks.