vrghost
vrghost

Reputation: 1224

How to store large user-specific data

So I'm in the middle of planning a little web app that will require quite large amounts of data stored on a user level, in one case, the system would take a large object from a system level and make a "user specific" version, a user can have multiple ones of these. Simplest would be to compare it to a form stored in a google spreadsheet, where the user is expected to use the template spreadsheet, then change not only the answers but also the question. Security wise I am quite OK

In the second case there is requirement to store multiple objects, size about 250k to maybe 3mb, once again on a user specific level, with a potential to move it to a system level so additional users can access it. As an example, say the user can upload pictures, but may not want to share all of them. However, a user may choose to "publish" a small number of them because they are happy with those specific pictures.

What design patterns should I consider using specifically around web apps where the user have decent amounts of data? For example, would it make most sense to use a single large database and have a table that keeps track of resources or create separate tables per user?

I have considered putting it all in a mongo database.

Upvotes: 1

Views: 122

Answers (1)

Fabian Stern
Fabian Stern

Reputation: 386

Your approach may be wrong.

If you want to store user based binary data and make it accessible for the user itself or the community, you would need a hierarchic structure like so:

  • userid1
    • pic1,pic2,pic3
  • userid2
    • pic4,pic5,pic6
  • community
    • pic7,pic8

You could then grant read permissions to "community" for all users, and permission for each user to its own directory.

Usually there is nothing wrong using a database to store binary files if you consider partitioning, role permissions and an applicable interface to access the data.

My suggestion is to use a binary repository like Artifactory. It provides hierarchic structures, simple search queries using HTTP requests and has caching abilities for frequently queried objects. I also think that http requests are a lot easier to use and also there is an abstraction layer to the data which is more secure.

Artifactory is free.

Upvotes: 1

Related Questions