openlink / virtuoso-opensource

Virtuoso is a high-performance and scalable Multi-Model RDBMS, Data Integration Middleware, Linked Data Deployment, and HTTP Application Server Platform
https://vos.openlinksw.com
Other
854 stars 211 forks source link

EnabledGzipContent (HTTP Gzip compression) has no effect #1308

Closed KonradHoeffner closed 1 month ago

KonradHoeffner commented 1 month ago

According to the docs, (see quote below), EnabledGzipContent in virtuoso.ini or http_enable_gz(1); in ISQL should enable HTTP compression:

EnabledGzipContent = 0. This sets the default behavior of HTTP transmission. If set to 1 The Virtuoso HTTP server will send GZipped content to user agents. Otherwise content will be sent as is. The function http_enable_gz() lets you change the server mode on the fly.

However both of these don't work:

According to the DockerHub documentation, virtuoso.ini variables can be set via environment variables as VIRT_SECTION_KEY=VALUE. Following this scheme, we should activate it using `VIRT_HTTPSERVER_ENABLEDGZIPCONTENT=1´. However when we run virtuoso as a docker image as follows, we don't get compressed results:

docker run --network=host -e VIRT_HTTPSERVER_ENABLEDGZIPCONTENT=1 openlink/virtuoso-opensource-7:7.2.13

If we open http://localhost:8890/sparql, the Firefox and Chrome web developer tools in the network tab do not show any compression, although gzip is requested:

Request Headers

GET /sparql HTTP/1.1
Host: localhost:8890
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br, zstd
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Priority: u=0, i

Response Headers

HTTP/1.1 200 OK
Server: Virtuoso/07.20.3240 (Linux) x86_64-ubuntu_focal-linux-gnu
Connection: Keep-Alive
Date: Thu, 08 Aug 2024 11:03:50 GMT
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Content-Length: 16173

For comparison, when opening https://dbpedia.org/sparql, I get this:

HTTP/1.1 200 OK
Date: Thu, 08 Aug 2024 11:04:51 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Server: Virtuoso/08.03.3330 (Linux) x86_64-generic-linux-glibc212  VDB
Expires: Thu, 15 Aug 2024 11:04:51 GMT
Cache-Control: max-age=604800
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Depth,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Accept-Encoding
Content-Encoding: gzip

Note the Content-Encoding: gzip.

Also discussed in https://stackoverflow.com/questions/78819781/how-to-compress-query-results.

HughWilliams commented 1 month ago

We are looking into this ...

openlink commented 1 month ago

This has been fixed by commit https://github.com/openlink/virtuoso-opensource/commit/a09ba100dec26a428a642325856da848eacc847f on the develop/7 branch.

I pushed a new docker image pkleef/virtuoso-opensource-7:latest to Dockerhub.

KonradHoeffner commented 1 month ago

Can confirm, this works perfectly with:

docker run --rm --network=host -e VIRT_HTTPSERVER_ENABLEDGZIPCONTENT=1 pkleef/virtuoso-opensource-7