Compress TSV exports#1314
Conversation
| put("server.compression.enabled", "true"); | ||
| // Spring Boot compresses HTML, JSON and other types by default, but not TSV. We have to duplicate the | ||
| // defaults and add text/tab-separated-values | ||
| put("server.compression.mime-types", "text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml,text/tab-separated-values"); |
There was a problem hiding this comment.
I see one use of text/json in our code, but I don' think we're using that in responses.
There was a problem hiding this comment.
I do not think text/json is a valid mime-type. It should only be application/json according to RFC8259.
|
TSVs are compressed. What about other common mime types?
|
I went with CSV and SVG, as they're text formats that will compress well. TTF is less compelling given their static nature, but I added it. Excel and PNG are already compressed |
|
CSVs are compressed but none of the SVGs or TTF files are. |
When serving static files, whether they're part of a module or not, the request is served by DavController. It uses Tomcat's Dynamically generated content like TSV exports go through a Stream and therefore get compressed per the settings in this change. I was on the fence about including TTF in the compression list, and just reverted them. They're cached so it shouldn't be much of a difference in real-world perf. I propose no other changes at this point. The main concern was compressing large TSV exports, which this change accomplishes. |
Rationale
Spring Boot compresses many text HTTP responses by default. But not TSV.
Changes
text/tab-separated-valuesto the default set of compressed MIME types