config load-balance compression
Use this command to configure compression options.
The following content types can be compressed:
- application/javascript
- application/soap+xml
- application/x-javascript
- application/xml
- text/css
- text/html
- text/javascript
- text/plain
- text/xml
Not all HTTP responses should be compressed. Compression offers the greatest performance improvements when applied to URLs whose media types compress well, such as repetitive text such as tagged HTML, and scripts such as JavaScript. Files that already contain efficient compression such as GIF images usually should not be compressed, as the CPU usage and time spent compressing them will result in an increased delay rather than network throughput improvement. Plain text files where no words are repeated, such as configurations with unique URLs or IPs, also may not be appropriate for compression.
Before you begin:
- You must have a good understanding of HTTP compression and knowledge of the content types served from the backend real servers.
- You must have read-write permission for load balancing settings.
Compression is not enabled by default. After you have configured a compression rule, you can select it in the profile configuration. To enable compression, select the profile when you configure the virtual server.
Syntax
config load-balance compression
edit <name>
set cpu-limit <integer>
set max-cpu-usage <integer>
set min-content-length <integer>
set uri-list-type {include | exclude>
config uri_list
edit <No.>
set uri <string>
next
end
config content_types
edit <No.>
set content-type {application/javascript | application/soap+xml | application/x-javascript | application/xml | text/css | text/html | text/javascript | text/plain | text/xml}
next
end
next
end
cpu-limit |
Enable/disable application of a CPU limit. |
max-cpu-usage |
Maximum CPU usage for compression operations. The default is 80. |
min-content-length |
Do not compress files smaller than this size. The default is 1024 bytes. |
uri-list-type |
Specify whether to include or exclude items in the list from compression. |
config uri_list |
|
uri |
Specify URIs to build a list or sites to include/exclude from compression. You can use regular expressions. |
config content_type |
|
content-type |
|
Example
FortiADC-VM (compression) # config load-balance compression
FortiADC-VM (compression) # edit lb-compression
Add new entry 'lb-compression' for node 1627
FortiADC-VM (lb-compression) # get
min-content-length : 1024
cpu-limit : enable
max-cpu-usage : 80
uri-list-type : exclude
FortiADC-VM (lb-compression) # set max-cpu-usage 50
FortiADC-VM (lb-compression) # end