Database Vs JSON Vs Embedded Databases

2019-08-16 05:06发布

问题:

I have a web application which has a fair amount of user base. The application currently uses MySQL for storing all the data, be it static or user data. The problem is that I have recognized some data which is never going to change frequently in the database but there is a probability that it might!

I am using REST calls for fetching the data from the database which is in the form of a JSON, the questions in my mind are:

  • Should we store the not changing data as static JSON files? I know it will kill the relationship that I could have established with that data.
  • Another point is Embedded Databases or in-memory database, are they a good alternative to store not so reverently changing data?

回答1:

Regarding performance, no assumptions are safe. You should always measure things, in order to come up with a conclusion. Therefore, in your position I would do some load testing and then start changing things. I would reject the file based solutions and suggest the next optimizations/changes to check:

  • MySQL provides some capabilities of "storing information in memory buffers to increase performance"

  • I would consider using a NoSQL database like MongoDB which is optimized for accessing JSON data.

  • If none of the above were adequate, I would consider using a memory related database like VoltDB which has a community edition.

Hope I helped!