开发者

Binary data under 20KB : BLOB or filesystem?

开发者 https://www.devze.com 2022-12-21 14:59 出处:网络
I\'m developing web app that user can save his/her work to server. The data will be saved is in variable-length binary form, it\'s size mostly under 20KB (sometimes little bigger < 100KB). The data

I'm developing web app that user can save his/her work to server. The data will be saved is in variable-length binary form, it's size mostly under 20KB (sometimes little bigger < 100KB). The data wi开发者_C百科ll often be changed / updated.

I have 2 options saving the data in server: as BLOB (mysql) or as filesystem with reference to its filepath stored in db server. I heard that each option have pro and cons.

Which is best for my app ?

Thanks


I'd probably go for the DB approach. The speed difference isn't likely to be that much, and I'm a big fan of having all data stored in one place. It's much easier to get a consistent back up of a database then it is to backup a database, filesystem, and associated data (and preserve consistency)

It also provides a uniform access method, consistent permissions, and allows you to access things remotely without setting up a separate service.

That said, it may be worth your while to keep your options open and not tie it to the db too tightly in case you want to move later.


I recommend placing it in the DB. It makes little sense building a special format for storage and access of this data, just to avoid going through the DB. What about simultaneous accesses from multiple instances of your application (a likely scenario in a web app)? With a DB you can leave these worries to the DB engine if you just use it correctly. With your home-cooked file format you'll be in trouble.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号