Using S3 as a database vs. database (e.g. MongoDB)

前端 未结 2 1015
南旧
南旧 2020-12-24 05:54

Due to simple setup and low costs I am considering using AWS S3 bucket instead of a NoSQL database to save simple user settings as a JSON (around 30 documents).

I re

2条回答
  •  太阳男子
    2020-12-24 06:25

    Context: we use S3 for some "database" (lit. key/value structured storage).

    It should be noted that S3 does actually have search and, depending on how you structure your data, queries in the form of S3 Select (and, if you have the time: Athena).

    However the biggest disadvantage/architectural challenge is that S3 is eventually consistent (which is actually the reason why you cannot "update" a file). This manifests itself in some behaviours which your architecture will need to tolerate:

    • Operations are cached by key, so if you attempt to get an object that doesn't exist, and then create it- for a period of time* any gets on that object will return that it does not exist.
    • There is no global cache, so you can get two different versions of the same object for a period of time* after it has been overwritten.
    • List operations provide a semi-unstable iterator. If you're going to list on a large number of objects in a bucket that is being updated, then chances are you are not going to visit all the objects by the end of the iterator.

    *period of time is purposely undefined by AWS, however, from observation, it is rarely more than a minute.

提交回复
热议问题