From 88a481da8aaa3879303169f92a0f38f24af1a880 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Sun, 30 May 2021 23:33:44 +0100 Subject: [PATCH] fix: drop gzip support, improve performance. (#1854) BREAKING CHANGE Not gzipping the output more than doubles the throughput for a simple "do nothing" RPC function. Postgrest's gzip support was surprisingly slow, lacked in configurability, was undocumented and untested. It was possible to achieve this before by not sending `Accept-Encoding: gzip`, but that turned into a bit of an undocumented gotcha. Most browsers do send it and by default a proxy pass would forward this header. Better to not support gzip at all, further focusing on ensuring Postgrest is a minimal layer over Postgres. Nginx, or whatever proxy, provides critical options such as min length, vary headers and so forth, and will likely have much better performance as well. --- CHANGELOG.md | 3 ++- src/PostgREST/Middleware.hs | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 729378382..4535da099 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #1560, Volatile RPC called with GET now returns 405 Method not Allowed instead of 500 - @wolfgangwalther - #1604, Change the default logging level to `log-level=error`. Only requests with a status greater or equal than 500 will be logged. If you wish to go back to the previous behaviour and log all the requests, use `log-level=info` - @steve-chavez - #1617, Dropped support for PostgreSQL 9.4 - @wolfgangwalther - + - #1854, Dropped undocumented support for gzip compression (which was surprisingly slow and easily enabled by mistake). In some use-cases this makes Postgres up to 3x faster - @aljungberg + ## [7.0.1] - 2020-05-18 ### Fixed diff --git a/src/PostgREST/Middleware.hs b/src/PostgREST/Middleware.hs index ee41e58fd..d8b09529e 100644 --- a/src/PostgREST/Middleware.hs +++ b/src/PostgREST/Middleware.hs @@ -116,7 +116,6 @@ pgrstFormat minStatus date req status responseSize = pgrstMiddleware :: LogLevel -> Wai.Application -> Wai.Application pgrstMiddleware logLevel = logger - . Wai.gzip Wai.def . Wai.cors corsPolicy . Wai.staticPolicy (Wai.only [("favicon.ico", "static/favicon.ico")]) where