www.youtube.com
SQLite Works in Production… But Drogon Makes It Hard
Excerpt
SQLite has become really good. So good, that some companies are using it in production. I want to do the same, but with C+.+ and the drogon framework. It should be easy, but it's not. That's because you need to configure SQLite for optimal saas/web-app performance (the defaults are pretty bad). And, the way that SQLite is configured clashes with drogon's database connection pools. … {ts:21} database connection pools that make this annoyingly hard. Here's what's going on and how to work around it. So to con set {ts:30} up SQLite for production web app use you need two things. First the right SQLite configuration because in true C C++ {ts:39} style SQLite's defaults are optimized for maximum backward compatibility not modern optimized performance. … Well, here's where it starts getting complicated. You see, other databases store their {ts:67} configuration the normal way in config files. SQLite doesn't. Instead, you execute a series of pragma queries such {ts:76} as pragma journal mode equals wall. That's a very important one. Here, we enable foreign keys. … {ts:153} it gets. We've got no idea what the settings are when our ex when our queries get executed because we don't {ts:159} know which connection in the pool they go on. Drogon won't do these pragma calls for you on {ts:165} startup and you can't request I want connection zero, connection one or two. … {ts:222} don't like modifying third party dependencies because it makes updating them harder and getting my changes into {ts:230} the official version not guaranteed and that can be take a long time. {ts:237} Third option is to compile my own SQLite with the defaults that I want baked in.
Related Pain Points
SQLite default settings not optimized for production performance
7SQLite's default configuration is optimized for backward compatibility rather than modern performance, requiring manual tuning of settings like WAL mode, cache size, and other pragmas. Developers often assume defaults are production-ready, leading to significant performance degradation in web applications and production deployments.
Difficulty keeping SQLite updated in C++ projects
4Developers struggle with updating SQLite in C++ projects. Modifying third-party dependencies makes updates difficult, and developers often resort to compiling SQLite from source with custom defaults baked in rather than modifying framework dependencies.