How should you store and serve static JSON data?

Viewed 16

I have five JSON files each containing approximately 20-30MB of data. I need to selectively serve a subset of this data to the client. Should this data be imported into my Express project and stored in memory as a variable (fast but potentially a waste of memory) or should it be stored in a database (such as MongoDB) and fetched as and when it is needed?

Given the data is static, it seems over the top to store it in a database (which adds potentially unnecessary complexity), however, I'm unaware of how much data should be stored in the memory of the server and whether it presents issues in terms of expense and scaling.

(I realise this question is somewhat subjective. I am interested in whether there is a generally accepted consensus on this matter)

0 Answers
Related