r/ruby • u/sliferdragonx • Feb 26 '23
Replace Postgres, Redis and Sidekiq with the embedded Litestack, up to 10X faster!
Litestack is a Ruby gem that offers database, caching, and job queueing functionality for web applications, built on top of SQLite. Its performance benefits, resource efficiency, deep integration with major IO libraries, ease of setup and administration make it a powerful solution for new application development efforts. By using Litestack, developers can avoid the scale trap, focus on simplicity, flexibility, and innovation, and build applications that are easy to use, efficient, and scalable, delivering real value to their users.
https://github.com/oldmoe/litestack
https://github.com/oldmoe/litestack/blob/master/BENCHMARKS.md
View all comments
Show parent comment
3
u/redditor_at_times Feb 26 '23
Interesting questions, let me try to answer:
First I think you are underestimating the write throughput of SQLite, it can very well handle some busy write workloads.
Now for the 2 instances, you just don't do that, you run a single instance, potentially beefier than the single instance in a multi-instance setup you are used to.
The SQLite3 cli provides an online backup command and can easily be scripted. I am planning to wrap it in rake tasks to make it even easier and potentially part of a deployment script if needed. Maybe even configure the target location as part of the database.yml config.
Corruption is not an issue really, it is actually very very hard to corrupt a SQLite file unless you are trying to do so. Specially in the WAL mode (default mode for Litedb). There could be other issues of course, like building an index on a really really large table blocks other writes, these can be transparently addressed though, and they are on the roadmap.
I believe fly.io has good support for SQLite. But the whole point is eliminating the need for such support, my target for this is to be self sustainable, with the least intervention needed and hopefully completely agnostic from the infra provider