We are going to learn about IIS compression today. In fact, IIS compression is not a new technology, but for SharePoint sites, IIS compression can play a major role. Next, let's learn about this.
After the IIS compression function is enabled on the IIS server, before the IIS server sends the page content to the browser, It compresses the content on the server and then sends the compressed data, after the browser receives the data, it automatically decompress it and then displays it. Because the data transmitted over the network is compressed, the page content can be transmitted to the browser faster to improve the page browsing speed.
Although it takes some CPU time to compress the page content on the IIS server, this does not cause any problems for the CPU of mainstream servers. In addition, the CPU time is too low compared with the data transmission time saved. After a page is compressed each time, IIS caches the compressed files to the disk to avoid repeated compression next time.
Enabling IIS compression on the IIS server can be done through the IIS manager on the GUI, but some configurations cannot be done only through the IIS manager, we use a script tool of IIS for all management and configuration. The following commands must be executed at the command prompt on the server.
Enable IIS compression on iisserver:
- cscript C:\Inetpub\adminscripts\adsutil.vbs set w3svc/filters/compression/parameters/HcDoStaticCompression true
Enable dynamic files such as. asp on the IIS server) IIS compression:
- cscript C:\Inetpub\adminscripts\adsutil.vbs set w3svc/filters/compression/parameters/HcDoDynamicCompression true
Add the ". aspx" file type to dynamic file IIS compression. All pages of the SharePoint site are. aspx). Run the following two commands:
- cscript C:\Inetpub\adminscripts\adsutil.vbs SET W3SVC/Filters/Compression/Deflate/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
- cscript C:\Inetpub\adminscripts\adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
Increase the default IIS compression ratio by using two commands:
- cscript C:\Inetpub\adminscripts\adsutil.vbs SET W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel "9"
- cscript C:\Inetpub\adminscripts\adsutil.vbs SET W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel "9"