Reputation: 37
So I'm making a bot for Discord, and I'm using a ORM, Sequelize, with SQLite as database engine. My bot will basically have a shop where you can buy items, so I want to store items in the database, so I thought about it this way.
const UserItems = sequelize.define("useritems", {
user_id: Sequelize.STRING,
item_id: Sequelize.STRING,
count: {
type: Sequelize.INTEGER,
defaultValue: 0,
allowNull: false,
},
});
The problem with this is that my game will have about 100 items, taking in account that my bot will have up to about 1k users, wouldn't this way of storing the user items too heavy and slow?
Upvotes: 0
Views: 774
Reputation: 2531
It's hard to say if your game will stress the system. So what you can do is try writing your application and infrastructure to be scalable.
Specifically, when talking about scalability regarding stateful components (DB, Queue, etc) you will find more often than not the ability of Replica Set
and Sharded Cluster
.
See: https://dba.stackexchange.com/questions/52632/difference-between-sharding-and-replication-on-mongodb
I found litereplica
which supports Replica Set
for SQLite. It's pretty easy to set up because you will only need to update your connection string to include an array of hosts instead of a single one.
So if your application can have a dynamic connection string (can be set via environment) you will be future proof and you will be able to add more SQLite instances when you will need them.
Upvotes: 2