Hmm, but the problem with having in-memory objects rather than a db is you end up having to replicate alot of the features of a relational database to get a usable system. And adding all these extra features you want from those dbs end up making a simple solution not very simple at all.
Building a highly-available web service without a database
61–70 of 187 posts
Re: Building a highly-available web service without a database
#62Re: Building a highly-available web service without a database
#63> Imagine all the wonderful things you could build if you never had to serialize data into SQL queries. This exists in sufficiently mature Actor model[0] implementations, such as Akka Event Sourcing[1], which also addresses: > But then comes the important part: how do you recover when your process crashes? It turns out that answer is easy, periodically just take a snapshot of everything in RAM. Intrinsically and with…
If you choose say Cosmos DB, MongoDB or DynamoDB as your persistence provider you can even query the persisted state.
https://learn.microsoft.com/en-us/dotnet/orleans/grains/grai...
https://learn.microsoft.com/en-us/dotnet/orleans/grains/tran...
https://learn.microsoft.com/en-us/dotnet/orleans/grains/even...
Re: Building a highly-available web service without a database
#64When I asked people working on it if they considered Redis or Mongo or Postgres with jsonb columns, they just said they considered all of those things but decided to roll out their own db anyway because "they understood it better".
This article gives off the same energy. I really hope it works out for you, but IMO spending innovation tokens to build a database is nuts.
Re: Building a highly-available web service without a database
#65Earlier quoted context omitted.
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…
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
#66I would use cloudflare R2 but its not globally distributed so its pointless using it on edge otherwise I get the messaging with edge you the database is the bottleneck just need a one stop shop to do edge functions + edge db
Cloudflare's durable objects seem similar to this article's "objects in RAM", but I think you still have to do some minimal serialization.
https://www.microsoft.com/en-us/research/project/orleans-vir...
Re: Building a highly-available web service without a database
#67Re: Building a highly-available web service without a database
#68I once saw a project in the wild where the "database" was implemented using filesystem directories as "tables" with JSON files inside as "rows". When I asked people working on it if they considered Redis or Mongo or Postgres with jsonb columns, they just said they considered all of those things but decided to roll out their own db anyway because "they understood it better". This article gives off the same energy. I r…
AWS and other cloud providers are money printers because a lot of engineers are insanely tied into established patterns of doing things and can't think through things at a fundamental level. Ive seen company backends where their entire AWS stacks could be replaced by a 2 EC2 instances behind a load balancer with a domain name, without affecting business flow.
We did something similar to the work in the OP post at my work, we had a bunch of ECS tasks for a service, where the service did another call to an upstream service to fetch some intermediate results. We wanted to cache results for lower response latency. People were working to set up a Redis cluster. Except the TPS of the service was like 0.1.
Took me one day to code a /sync api endpoint, which was just a replica of the main endpoint. The only difference is that the main endpoint would spin of a thread to call the /sync endpoint, whereas the /sync endpoint didn't. Both endpoints ended with caching the results in memory before returning. Easy as day, no additional infra costs necessary.
But overall, personally, I don't hate the "spending innovation tokens to build a database is nuts" sentiment too much, because it keeps me employed at high salary while doing minimal work, where things that really should be basic CS are considered innovation.
Re: Building a highly-available web service without a database
#69We didn’t want to build something complicated, so we implemented our own raft consensus layer. Have you considered just using Redis?
Re: Building a highly-available web service without a database
#70It claims to solve a bunch of problems by ignoring them. There are solid reasons why people distribute their applications across multiple machines. After reading this article I feel like we need to state a bunch of them.
Redundancy - what if one machine breaks either a hardware failure a software failure or a network failure (network partition where you can’t reach the machine or it can’t reach the internet)
Scaling- what if you can’t serve all of your customers from one machine ? Perhaps you have many customers and a small app or perhaps your app can use a lot of resources (maybe it loads gigs of data)
Deployment - what happens when we want to change the code and not go down if you are running multiple copies of your app you get this for cheap
There are tons of smaller benefits - right sizing your architecture What if the one machine you choose is not big enough you need to move to a new machine, with multiple machines you just increase the number of machines. You also get to use a variety of machine sizes and can choose ones that fit your needs so this flexibility allows you to choose cheaper machines
I feel like the authors don’t know why people invented the standard way of doing things.