|
|
|
|
|
by miki123211
1985 days ago
|
|
I use the same system (a JSON file protected with a mutex) for an internal tool I wrote, and it works great. For us, file size or request count is not a concern, it's serving a couple (internal) users per minute at peak loads, the JSON is about 150 kb after half a year, and old data could easily be deleted/archived if need be. This tool needs to insert data in the middle of (pretty short) lists, using a pretty complicated algorithm to calculate the position to insert at. If I had used an RDBMS, I'd probably have to implement fractional indexes, or at least change the IDs of all the entries following the newly inserted one, and that would be a lot of code to write. This way, I just copy part of the old slice, insert the new item, copy the other part (which are very easy operations in Go), and then write the whole thing out to JSON. I kept it simple, stupid, and I'm very happy I went with that decision. Sometimes you don't need a database after all. |
|
[0] Via mutex in your case. Have you thought about durability, though. That one's actually weirdly difficult to guarantee...