V8-archive: Use file streaming instead of reading to memory

Created on 10 Dec 2019  路  1Comment  路  Source: directus/v8-archive

Currently, the API reads file into memory on upload _and_ /assets/ download, which makes it impossible to upload files that are bigger than ~100MB* and makes opening existing thumbnails slow.

We should use Streams to read / write / serve files, instead of reading them into memory whenever we can.

https://flysystem.thephpleague.com/docs/usage/filesystem-api/
https://odan.github.io/2018/03/09/emitting-chunked-stream-responses-with-slim.html

* Depending on your server's memory and max php limits

bug enhancement

Most helpful comment

This is causing us issues now, because having lot of thumbnails displayed on page and therefore browser making lot of parallel requests creates a huge load on the server (compared to previous thumbnailer in which the file was accessed and served directly). It brings smaller AWS instnaces to crash (having just Directus docker container running).

>All comments

This is causing us issues now, because having lot of thumbnails displayed on page and therefore browser making lot of parallel requests creates a huge load on the server (compared to previous thumbnailer in which the file was accessed and served directly). It brings smaller AWS instnaces to crash (having just Directus docker container running).

Was this page helpful?
0 / 5 - 0 ratings