3 ms·
I used SQLx with an SQLite database and ran into connection pool problems that would cause the database to be unexpectedly dropped. The issues I saw seem to be
by thesuperbigfrog 1y ago
I used SQLx with an SQLite database and ran into connection pool problems that would cause the database to be unexpectedly dropped.
The issues I saw seem to be related to these issues:
https://github.com/launchbadge/sqlx/issues/3080 https://github.com/launchbadge/sqlx/issues/3080
https://github.com/launchbadge/sqlx/issues/2510 https://github.com/launchbadge/sqlx/issues/2510
The problems did not manifest until the application was under load with multiple concurrent sessions.
Troubleshooting the issue by changing the connection pool parameters did not seem to help.
I ended up refactoring the application's data layer to use a NoSQL approach to work around the issue.
I really like the idea of SQLx and appreciate the efforts of the SQLx developers, but I would advise caution if you plan to use SQLx with SQLite.
- zbentley 1y agoAs a total outsider to sqlx, those issues don’t surprise me: any application on any platform that uses a SQLite in-memory DB concurrently is likely to violate many assumptions made by client-side connection pooling tools. In-memory SQLite is a great tool, but using it indirectly behind a connection pooler that assumes the database is external to the current process is bound to cause problems.
- stmw 1y agoAgree with zbentley, I actually wouldn't expect this to work well - perhaps a good thing for sqlx team to warn against.
- cortesi 1y agoSQLx is great, but I had a long laundry list of issues with its SQLite support so I forked it into a focused SQLite-specific library. It has now diverged very far from SQLx, and the number of small inaccuracies and issues we fixed in the low-level SQLite bindings is well into the dozens. The library is unannounced, but is already being used in some high-throughput scenarios. https://github.com/cortesi/musq https://github.com/cortesi/musq
- thesuperbigfrog 1y agoMusq looks very friendly. I will try it in a future project. Thank you for sharing it!