News for hackers. Stuff that matters.
Re:Litestream Eliminated My Database Server for $0.03/Month by mtlynch on Thursday April 29, 2021 @10:02AM (#26981276)
Author here.

I discovered Litestream here on HN after benbjohnson shared it here a few months back.[0] I wasn't interested at first because I don't ever use SQLite, but it stuck with me. I eventually realized it's a great way to achieve vendor flexibility in hosting apps, so I used Litestream to build a pastebin-style service for my app and wanted to share what I learned.

Happy to answer any questions or hear any feedback about this post.

[0] https://news.ycombinator.com/item?id=26103776

Re:Litestream Eliminated My Database Server for $0.03/Month by benbjohnson on Thursday April 29, 2021 @10:24AM (#26981554)
Litestream author here. Great explanation of how everything works! That's awesome that's only running at $0.03/month. :)
Re:Litestream Eliminated My Database Server for $0.03/Month by mtlynch on Thursday April 29, 2021 @10:37AM (#26981714)
Hey Ben! Thanks again for your work on Litestream and for your help with this post. I'm excited to see Litestream continue growing in popularity.
Re:Litestream Eliminated My Database Server for $0.03/Month by amzans on Thursday April 29, 2021 @10:11AM (#26981404)
Just wanted to say thank you for writing this Michael. You've been putting lots of great content on your blog! Really enjoying the real world examples you include.
Re:Litestream Eliminated My Database Server for $0.03/Month by mtlynch on Thursday April 29, 2021 @10:24AM (#26981549)
That's great to hear. Thanks for reading and for the kind words!
Re:Litestream Eliminated My Database Server for $0.03/Month by jfengel on Thursday April 29, 2021 @02:17PM (#26984495)
Question from a newbie to cloud stuff: what is the performance like for a database server that's separated from your host like that?

In terms of latency alone it sounds like it risks adding tens or even hundreds of milliseconds to even a fairly trivial request: out of my datacenter, across the wire, into theirs, grab the data, and then reverse the path. And perhaps a charge for data going out each way.

Am I wrong about that? Am I overestimating the travel time, or perhaps they end up being located in the same datacenter so it's all high speed?

Re:Litestream Eliminated My Database Server for $0.03/Month by benbjohnson on Thursday April 29, 2021 @02:30PM (#26984679)
It's typical to see at least millisecond latency for a database server that's located in the same data center (e.g. hosting your own Postgres) and tens or hundreds of milliseconds for cloud database services that run outside your data center.

The OP's approach of SQLite & Litestream removes that latency entirely since the database is colocated with the application. Litestream will stream backups to an external service (e.g. S3) and that can have tens or hundreds of milliseconds of latency but that won't affect the application's performance since it is asynchronous replication.

Re:Litestream Eliminated My Database Server for $0.03/Month by jfengel on Thursday April 29, 2021 @03:54PM (#26985880)
Ah, I had misread how that worked. That makes a ton of sense. Thank you.
Re:Litestream Eliminated My Database Server for $0.03/Month by webmobdev on Thursday April 29, 2021 @02:33PM (#26984721)

    what is the performance like for a database server that's separated from your host like that?
It's not separated. As this diagram shows - https://mtlynch.io/litestream/diagram.jpg - the SQLite database is on the same server as the web application. Additionally, OP's setup seems to use Litestream to backup the SQLite database to some cloud storage.