Extreme Sharding: One SQLite Database Per User

后端 未结 8 1350
终归单人心
终归单人心 2021-01-30 13:43

I\'m working on a web app that is somewhere between an email service and a social network. I feel it has the potential to grow really big in the future, so I\'m concerned about

8条回答
  •  独厮守ぢ
    2021-01-30 14:04

    One possible problem is that having one database for each user will use disk space and RAM very inefficiently, and as the user base grows the benefit of using a light and fast database engine will be lost completely.

    A possible solution to this problem is to create "minishards" consisting of maybe 1024 SQLite databases housing up to 100 users each. This will be more efficient than the DB per user approach, because data is packed more efficiently. And lighter than the Innodb database server approach, because we're using Sqlite.

    Concurrency will also be pretty good, but queries will be less elegant (shard_id yuckiness). What do you think?

提交回复
热议问题