I recently implemented Node cluster as a way to vertically scale my application. Since it uses multiple threads now I naturally added stress tests to the application and that revealed an issue with my application.
So for the sake of this question I will really simplify my setup. I have Node clustered app and each one of children processes is accessing the same SQLite file. I know that is not the ideal solution but to my knowledge when concurrent queries try to access it the latter one should wait for the database to become free. Unfortunately, this is not happening.
I am getting the following error
Error: SQLITE_BUSY: database is locked
errno: 5, code: 'SQLITE_BUSY'
My configuration is
"sqlite": {
"client": "sqlite3",
"connection": {
"filename": "app/database/database.sqlite"
},
"useNullAsDefault" : true,
"pool": {
"min": 1,
"max": 1 <- i tried increasing this to the number of cluster instances
}
}
Is there a solution for this, other than removing the SQLite in general?