Project

General

Profile

Actions

Feature #1410

open

When downloading a file from the repository : don't fill the memory with bytes

Added by Paul Rivier almost 16 years ago. Updated over 9 years ago.

Status:
New
Priority:
Normal
Category:
SCM
Target version:
-
Start date:
2008-06-09
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Current procedure for downloading a file from the repository implies dumping the bytes (all of them) into a string through method "cat", then serving the content of the string. Although it works well for small files, some problems are raised when using large files :
  1. dumping a file into the RAM is a bit risky, as it is quiet common now to have files larger than the memory size. And we don't want servers to swap :)
  2. it locks a ruby thread during the download time, which is a waste of ressources

Point 1) can probably be adressed using streams, but this won't fix point 2)
Point 1) and 2) can be fixed by dumping file content into a temporary file in the filesystem (RAILS_ROOT/tmp for example) and asking the webserver (apache, or any other) to serve the content as a static file. That would free the ruby process for some other work.

What do you think ?


Files

buffered_io.patch (15.2 KB) buffered_io.patch Pierre Paysant-Le Roux, 2008-11-24 23:27
buffered_io.patch (28.3 KB) buffered_io.patch Pierre Paysant-Le Roux, 2008-12-08 12:05

Related issues

Related to Redmine - Defect #29250: Problem with high RAM usage New

Actions
Has duplicate Redmine - Defect #11275: Large file downloadClosed

Actions
Actions

Also available in: Atom PDF