spring-boot啟用gzip壓縮測試
阿新 • • 發佈:2019-01-10
spring-boot啟用gzip壓縮提升資料介面的訪問速度
一、新增配置
傳輸資料大於1KB時啟用壓縮
server:
port: 7474
servlet:
context-path: /web
compression:
enabled: true
min-response-size: 1024
mime-types:
- image/png
- image/jpeg
- image/jpg
- text/html
- application/javascript
- text/css
- application/octet-stream
- application/json
spring:
thymeleaf:
cache: false
mvc:
static-path-pattern: /path/**
resources:
static-locations: classpath:/static/
二、介面測試
1、啟用壓縮之前
2、啟用壓縮之後
經過測試,啟用gzip資料流壓縮之後可以很有效的提升資料介面的訪問效率!