News for hackers. Stuff that matters.
Re:Building a highly-available web service without a database by Groxx on Saturday August 10, 2024 @12:49AM (#41207389)
I do feel like this largely summarizes as "we built our own sqlite + raft replication", yeah. But without sqlite's battle-tested reliability or the ability to efficiently offload memory back to disk.

So, basically, https://litestream.io/ . But perhaps faster switching thanks to an explicit Raft setup? I'm not a litestream user so I'm not sure about the subtleties, but it sounds awfully similar.

That overly-simplified summary aside, I quite like the idea and I think the post does a pretty good job of selling the concept. For a lot of systems it'll scale more than well enough to handle most or all of your business even if you become abnormally successful, and the performance will be absurdly good compared to almost anything else.

Re:Building a highly-available web service without a database by oefrha on Saturday August 10, 2024 @03:31AM (#41207934)
They basically only save on serialization & deserialization at query time, which I would consider an infinitesimal saving in the vast majority of use cases. They claim to be able to build some magical index that's not possible with existing disk-based databases (I didn't read the linked blog post). They lose access to a nice query language and entire ecosystems of tools and domain knowledge.

I fail to see how this little bit of saving justifies all the complexity for run-of-the-mill web services that fit on one or a few servers as described in the article. The context isn't large scale services where 1ms/request saving translates to $$$, and the proposal doesn't (vertically) scale anyway.

Re:Building a highly-available web service without a database by oefrha on Saturday August 10, 2024 @08:22AM (#41208975)
One thing I forgot to mention: if you use a not-in-process RDBMS on the same machine you also incur some socket overhead. But that’s also small.
Re:Building a highly-available web service without a database by rrrix1 on Saturday August 10, 2024 @12:38PM (#41210618)
You should probably RTFA before making broad assumptions on their solution and how it works. Most of what you wrote is both incorrect and addressed in the article.
Re:Building a highly-available web service without a database by oefrha on Saturday August 10, 2024 @09:38PM (#41213431)
Telling people to RTFA is against site guidelines. And I read the entire article before making this comment. If you think I’m wrong, you reply with what’s wrong, not some useless “you’re wrong, RTFA”.

The only thing in my comment that’s not directly based on the article is a handwavy 1ms/request saving estimate, and since they don’t provide any measurement, it’s anyone’s guess.

Re:Building a highly-available web service without a database by CBarkleyU on Sunday August 11, 2024 @03:51AM (#41214620)
Is telling the people to RTFA against the guidelines?

The guideline specifically advises to do what GP did: Instead of commenting whether or not someone read the article, to tell them that article answers their questions.

Re:Building a highly-available web service without a database by kitd on Saturday August 10, 2024 @01:58AM (#41207637)
Rqlite would be a better comparison. It is actually SQLite + raft

https://github.com/rqlite/rqlite

Re:Building a highly-available web service without a database by otoolep on Saturday August 10, 2024 @05:10AM (#41208270)
rqlite author here, happy to answer any questions.
Re:Building a highly-available web service without a database by lifeisstillgood on Saturday August 10, 2024 @06:30AM (#41208558)
So some dumb questions if you don’t mind

- In GitHub readme you mention etcd / consul. Is rqlite suitable for transaction processing as well ?

- I am imagining a dirt simple load balancer over two web servers. They are a crud app backed onto a database. What is the disadvantages of putting rqlite on each server compared to say having a third backend database.

Re:Building a highly-available web service without a database by otoolep on Saturday August 10, 2024 @06:51AM (#41208636)
As for your second question, I don't think you'd benefit much from than that, for two reasons: - rqlite is a Raft based system, with quorum requirements. Running 2-node systems don't make much sense. [1] - Secondly, all writes go to the Raft leader (rqlite makes sure this happens transparently if you don't initially contact the Leader node [2]). A load balancer, in this case, isn't going to allow you to "spread load". What is load balancer is useful for when it comes to rqlite is making life simpler for clients -- they just hit the load balancer, and it will find some rqlite node to handle the request (redirecting to the Leader if needed).

[1] https://rqlite.io/docs/clustering/general-guidelines/#cluste...

[2] https://rqlite.io/docs/faq/#can-any-node-execute-a-write-req...

Re:Building a highly-available web service without a database by otoolep on Saturday August 10, 2024 @06:45AM (#41208610)
It depends on what kind of transaction support you want. If your transactions need to span rqlite API requests then no, rqlite doesn't support that (due to the stateless nature of HTTP requests). That sort of thing could be developed, but it's substantial work. I have some design ideas, it may arrive in the future.

If you need to ensure that a given API request (which can contain multiple SQL statements) is atomically processed (all SQL statements succeed or none do) that is supported however [1]. That's why I think of rqlite as closer to the kind of use cases that etcd and Consul support, rather than something like Postgres -- though some people have replaced their use of Postgres with rqlite! [2]

[1] https://rqlite.io/docs/api/api/#transactions

[2] https://www.replicated.com/blog/app-manager-with-rqlite

Re:Building a highly-available web service without a database by lifeisstillgood on Saturday August 10, 2024 @07:32AM (#41208767)
Thank you - so my takeaway is that rqlite is well suited for distributed “publishing” of data ala etcd, but it is possible to use it as a Postgres replacement - thank you I will give it a go
Re:Building a highly-available web service without a database by Groxx on Saturday August 10, 2024 @01:21PM (#41210866)
I'll throw in a "ehh... sorta" though rqlite is quite neat and very much worth considering.

The main caveat here is that rqlite is an out-of-process database, which you communicate with over http. That puts it on similar grounds as e.g. postgres, just significantly lighter weight, and somewhat biased in favor of running it locally on every machine that needs the data.

So minimum read latency is likely much lower than postgres, but it's still noticeable when compared to in-process stuff, and you lose other benefits of in-process sqlite, like trivial extensibility.

Re:Building a highly-available web service without a database by kitd on Sunday August 11, 2024 @04:04AM (#41214682)
There's dqlite, which is a in-process sqlite with raft.

https://dqlite.io/

Re:Building a highly-available web service without a database by otabdeveloper4 on Saturday August 10, 2024 @04:31AM (#41208133)
SQlite doesn't do Raft. There isn't any simple way to do replicated SQlite. (In fact, writing your own database is probably the simplest way currently, if SQlite+Raft is actually what you want.)
Re:Building a highly-available web service without a database by carderne on Saturday August 10, 2024 @07:46AM (#41208819)
What about rqlite?