# SQLite Scaling Notes

If you are chosing to implement a SQLite database for each user in a multitenat environment you will want to minimize the number of open database/sql handles (`sql.Open`) that you have at any one time. A strategy you could use is an LRU cache of open handles. This way you will be able to maintain some control over number of resources you are instantiating.

Migrations may be a tough thing to do with a per user sqlite setup. Consider snapshoting the user's current DB, and creating a copy and applying the migration change. Also, you could apply the migrations when a new DB handle is created on the server side.

Sqlited hosts a SQLite file behind an HTTP API, this could help reduce the contention of a Single writer to a DB. But also having a DB per user will achieve the same thing.  
