Spike: Investigate how to upload large documents

Overview

We made several load testing scenarios for uploading documents and found that it can prevent to OutOfMemoryError in the mod-invoice-storage.

OutOfMemoryError occurs if uploading documents bigger than 5 Mb and standard heap 256Mb.

Test cases

1. Tests (3 iterations) + 5 Mb request (300 iterations) with heap 256Mb
Expected : documents uploaded
Actual : documents uploaded
See details PR with details

2. Tests (1 iterations) + 10 Mb request (30 iterations) with heap 256Mb
Expected : documents uploaded
Actual : documents _OutOfMemoryError occurs and mod-invoice-storage crashed
Note : If heap increase to 300Mb, then looks like the module begins to cope with documents and save them in the DB.

3. Tests (1 iterations) + 20 Mb request (30 iterations) with heap 256Mb
Expected : documents uploaded
Actual : documents OutOfMemoryError occurs and mod-invoice-storage crashed
Note : If heap increase to 500Mb, then looks like the module begins to cope with documents and save them in the DB.

Solutions

1. Increase module heap

After local quick testing we found, that increasing heap to ~600Mb solve this issue.

2. Save documents not into DB

There is FOLIO Spike for platform agnostic document storage : Platform agnostic object storage for Exports