1 | | It seems to use up RAM proportional to the size of the file being uploaded * 4. |
| 1 | Uploading files through the 'webish' frontend (with the upload form) results in a memory footprint of at least 2 * filesize. Downloading files might do the same. |
| 2 | |
| 3 | Zooko's first observations suggest this might be more like 4x. |
| 4 | |
| 5 | The main culprit seems to be the stdlib 'cgi' module, which twisted.web uses to parse the multipart-encoded upload form. The file to be uploaded appears as an input field in this form. |
| 6 | |
| 7 | A secondary thing to look at (if/when we fix the upload side) is to make the download side streaming (producer/consumer), to avoid buffering the whole file in the twisted Transport queue. |