Lobste.rs migrates to SQLite, cutting costs and improving performance
Lobsters moved from MariaDB to SQLite, reducing CPU, memory, and VPS costs while improving speed.
Consider using SQLite for lightweight Rails apps to cut hosting costs.
Summary
Lobste.rs completed a migration from MariaDB to SQLite, aiming to reduce hosting costs and improve performance. The migration involved a single VPS running a Rails application with a 3.8 GB primary SQLite database, a 1.1 GB cache database, a 218 MB queue database, and a 555 MB rack_attack database. CPU and memory usage dropped, and the site felt snappier to the author. The VPS cost was halved by removing the MariaDB instance. The migration PR added 735 lines and removed 593 lines across 30 commits and 188 files. The change was built on earlier PRs #1705, #1871, and #1924. The author notes that SQLite can support a full community site in 2026. This case study demonstrates the feasibility of lightweight databases for web applications.
Key changes
- Primary SQLite database 3.8 GB
- Cache database 1.1 GB, queue 218 MB, rack_attack 555 MB
- CPU and memory usage dropped, site snappier
- VPS cost halved by removing MariaDB
- Migration PR added 735 lines, removed 593 lines across 30 commits
- Built on PRs #1705, #1871, #1924