Overview
Because our project's three-dimensional model file is very large, in order to improve the transmission speed, on the server to do zip compression processing is very necessary, can greatly improve the transmission speed.
Configuration
First, you need to modify the mapping mapping relationship configuration for the MIME type of the requested data file in Web. XML, for example, to add a mapping relationship for a binary data file with the suffix named s3m:
< mime-mapping > < extension >s3m</extension> <Mime-type >application/octet-stream</mime-type></ Mime-mapping>
That is, the. s3m file corresponds to a MIME type of Application/octet-stream. Then edit the Connector element of the Tomcat configuration file Server.xml (the HTTP Connector element is a connection component that is supported for the http/1.1 protocol)
<ConnectorPort= "8090"Protocol= "http/1.1"ConnectionTimeout= "20000"Redirectport= "8453"Executor= "Tomcatthreadpool"enablelookups= "false"uriencoding= "Utf-8"Compression= "On"compressionminsize= "2048"Usesendfile= "false"Compressablemimetype= "Application/octet-stream" />
where compression= "on" setting turns on compression,
Compressionminsize= "2048" sets the minimum value of the compressed data, that is, the number of bytes of data must reach 2048 to enable compression.
Compressablemimetype= "Application/octet-stream"
The data that is set to the corresponding MIME type file is compressed, as in the previous mapping we configured in Webxml,
In addition, the Tomcat default setting is to enable file transfer (Sendfile) when the data size reaches 48kb, so we must set the Usesendfile to False when we want to compress more than 48kb of data, depending on the official document interpretation.
After configuring the above information, restart Tomcat to see the effect of releasing data in Iserver.
You can see that the original file is 117k, compressed to 66k, and the browser can extract the data in the appropriate format.
"Tomcat" Tomcat gzip compressed transfer data