I'm building a canvas editor and run into a challenge with storing a large JSON file that's about 50MB in size. The key issue is that I need to frequently mutate small parts of this JSON with minimal cost. I'm debating whether to store it in a database or in object storage (OSS). What would be the best approach for handling this scenario?
4 Answers
I feel like it depends on how often you're mutating it. For frequent small updates, a database is the way to go. But if you're making batch updates less often, maybe consider flexible object storage.
Totally! A combination of both methods could help you manage the balance between speed and storage efficiency.
If you're handling large JSON files like this, think about using a database, especially one that supports JSON types. Databases can handle updates more efficiently compared to object storage since you'd avoid downloading the entire file for small changes.
This makes sense! But how do you deal with the size limits of certain databases? Like, I heard that MongoDB has a limit on document size.
Good point! You might need to break your JSON into smaller documents for optimal performance—especially if one part is more frequently updated.
Using a document database could be a good fit here. They allow for partial updates right within the document, so you can change just the part of your JSON that you need, without rewriting everything.
That could save a lot of time! But what about the database size limits?
Exactly, you'd just need to manage the size by splitting larger JSON into manageable chunks.
Honestly, have you thought about breaking the JSON into multiple tables or using a more structured approach? It could simplify how you store modifications and snapshots separately, so you're not working with that giant blob all the time.
That's a solid suggestion! Splitting it could definitely improve performance.
Right? And you can create relationships in tables that make sense for your app's needs.

So you're saying a hybrid approach could work?