Live data from Hacker News

Building a highly-available web service without a database

blog.screenshotbot.io

61–70 of 187 posts

Re: Building a highly-available web service without a database

#61
post #20

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.

To some extent I think this is an "if all you have is a hammer..." situation. Relational DBs are often not a great fit for how contemporary software manages data in memory (hence the proliferation of ORMs, and adapter layers like graphql). I think it's often easier to write out one's relations in the data structures directly, rather than mapping them to queries and joins

Re: Building a highly-available web service without a database

#62
I’m not from “start up world” but in the end, few things give me more comfort and lack of surprises down the line than just having a relational database with built in redundancy/transaction logs/back up/recovery. Sure there might always be edge cases (lack of money, regulations, specialist software offering) but in the vast majority of cases - just get a database.

Re: 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…

I have built some medium sized systems using Microsoft Orleans (Virtual Actors). There was no transactional database involved, but everything was ordered and fully transactional.

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

#64
I 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 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

#65
post #43
post #24

Earlier 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

rqlite author here, happy to answer any questions.

Re: Building a highly-available web service without a database

#66
post #52

I 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.

The Cloudflare durable object is very much the same as a Virtual Actor

https://www.microsoft.com/en-us/research/project/orleans-vir...

Re: Building a highly-available web service without a database

#68
post #64

I 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…

This isn't innovation though. You literally just write your server like you would for a single machine, then wrap it any of the available Raft libraries.

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

#70
It’s great that people explore new ideas. However this does not seem like a good idea.

It 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.

Post reply on HN