top | item 45687458

/dev/null is an ACID compliant database

622 points| swills | 4 months ago |jyu.dev

190 comments

order

jihadjihad|4 months ago

In a similar vein, this is one of the most interesting things I’ve come across on HN over the years:

https://www.linusakesson.net/programming/pipelogic/index.php

Past HN post: https://news.ycombinator.com/item?id=15363029

Sharlin|4 months ago

This is probably old news to people interested in nonstandard methods of computation, but it just occurred to me that the fluid-based analogy to transistors is straightforward to construct:

              S
            |   |
     -------|   |
   G  \/\/|##|  |
     -------|   |
            |   |
              D
This is essentially a pressure regulator, except that the pressure is controlled by an independent signal. Pressure in G pushes a spring-loaded piston to block flow from S to D (a slightly different construction instead allows flow when G has pressure). Modulating the pressure in G can also used to modulate the flow, based on F = -kx. This simple construction has some issues, such as the fact that the pressure needed to move the piston depends on the pressure in S-D.

66yatman|3 months ago

export const parse = () => null export const stringify = () => 'null'

lloeki|4 months ago

Around 2004-2005 during some research at the end of my curriculum I happened to be doing with some specific jobs that were parallelised and data flowing as it was processed along a component diagram for visualisation, and it looked very familiar....

So I had this idea that you'd design code to be applied to a processing unit of specific capacity which would lead to execution flowing at a certain speed when applied a certain computation potential... and surprise surprise the relation would be uh, linear, and say you increase a loop's count and so the code would _resist_, or you'd increase computation potential to increase the flow.

So uh, yeah, Ohm's law but it's _code_ that's resistive.

And then I started to look for the pattern and find code with inductive properties, and code with capacitive properties, and some deeper properties emerged when you started modelling stuff with multiple processing units and data flowed around, split (map?), rejoined (reduce?).

And there was something strangely efficient about a way to see code that way and optimise using _laws_ describing the whole execution flow using familiar tools as a whole instead of thinking in gritty details barely higher-level than MOV AX... you "just" had to design code and the execution system so that it would operate in this kind of framework and allow that kind of analysis to identify bottlenecks and weird interplay actions across components.

And then I brought that up to my mentor and he said "well that's complete lunacy, stop thinking about that and focus on your current work" and, uh, case closed.

That was the young and naive me who thought that research labs were made to do think-outside-the-box connect-the-dots innovative stuff...

jmux|4 months ago

I hadn’t seen this before, this is sick! thanks for posting it here :)

gchamonlive|4 months ago

Best stack cloud providers don't want you to know about, /dev/null for db and https://github.com/kelseyhightower/nocode for the backend.

nomel|4 months ago

I've never had a single issue with any user after moving our databases to /dev/null.

hylaride|4 months ago

My god, AI crawlers probably train on Hacker News, too. The vibe coders sure are in for a shock in 2-6 months... :-D

quietbritishjim|4 months ago

WTF is going on with the issues and pull requests for that repo?

pyuser583|4 months ago

I've used /dev/null for exactly this purpose. I have output that needs to go somewhere, and I don't want to worry about whether that somewhere can handle it.

Later on in deployment, it will go somewhere else. Somewhere that has been evaluated for being able to handle it.

In that way, /dev/null is to storage what `true` is to execution - it just works.

CaptainOfCoit|4 months ago

Bug free software is a pipe dream, but if there is anything I've never encountered any bugs with, /dev/null and true is certainly in the top 3.

seanhunter|4 months ago

That is literally what it was added to unix for.

cluckindan|4 months ago

Always instantly consistent, always available, and perfectly tolerant of partitioning.

Truly, it is the only database which can be scaled to unlimited nodes and remain fully CAP.

inopinatus|4 months ago

Enterprise DBAs will nevertheless provision separate /dev/null0 and /dev/null1 devices due to corporate policy. In the event of an outage, the symlink from null will be updated manually following an approved run book. Please note that this runbook must be revalidated annually as part of the sarbox audit, without which the null device is no longer authorised for production use and must be deleted

eru|4 months ago

Not just instantly consistent on one machine, but globally sharded all across the universe.

thfuran|4 months ago

It's really fast too.

ozim|4 months ago

I guess we have a perfect idea for vaporware here. (pun intended)

I am putting my marketing hat on right now.

tgma|4 months ago

Always available? Clearly you have not experienced situations with no /dev mounted.

geoffbp|4 months ago

Is there a case where dev null can fail?

mjb|4 months ago

Best of all, /dev/null is also serializable (but not strict serializable) under many academic and textbook definitions.

Specifically, these definitions require that transactions appear to execute in some serial order, and place no constraints on that serial order. So the database can issue all reads at time zero, returning empty results, and all writes at the time they happen (because who the hell cares?).

The lesson? Demand real-time guarantees.

mjb|4 months ago

This doesn't work as cleanly for SQL-style transactions where there are tons of RW transactions, sadly.

magicalhippo|4 months ago

Reminds me of how in the math lectures, our professor would always point out he was ignoring the trivial solution[1].

That /dev/null is ACID compliant is the trivial solution of databases.

Still, a jolly good read, and a nice reminder that concepts like ACID don't exist in a vaccuum.

[1]: https://en.wikipedia.org/wiki/Triviality_(mathematics)#Trivi...

rollcat|4 months ago

You can dismiss it as a triviality, but in CS it's always worth considering (what you assume to be) an "identity" value, and its edge cases. Does your DSP algorithm work with near-zero values as well as it does with "true" zero?

(hint: look up subnormal floats.)

yupyupyups|4 months ago

>a nice reminder that concepts like ACID don't exist in a vaccuum.

Except if it's in /dev/null?

jefftk|4 months ago

"The system transitions from one valid state to another" is clearly false: the system only has a single state.

mpyne|4 months ago

One of the first state machine you'll ever learn about in undergrad permits transitions from a state back to itself, so I don't see this as a barrier.

exabrial|4 months ago

I saw a MongoDb implementation on Github awhile ago that was a wrapper around /dev/null. The thesis was if you're using MongoDb, you probably didn't weren't planning on querying anything later anyway.

dd_xplore|4 months ago

One question though, if for some reason a poorely designed app discards data through /dev/null, is it tamper proof? Meaning can any other process or user access that information? (In runtime)

dragonwriter|4 months ago

I think it is possible for a process with root to delete the existing /dev/null and replace it with a normal file (likely to produce system instability) or a new character device (could probably be mostly transparent to anyone who didn’t know where to look for it storing its data), in which case anything sent to it could be captured.

simultsop|4 months ago

You need an FAQ section, we have so many questions for this marvellous solution.

Is it portable to all linux distros?

Where is the ubuntu command to install it?

What license does it use, is it free or else?

Is it really open source or source only?

hmokiguess|4 months ago

I guess it is also idempotent then

imcritic|4 months ago

How does a disaster recovery plan with it look like?

tadfisher|4 months ago

There is never a disaster; reading from /dev/null will return the same result before and after any external event.

wolrah|4 months ago

/dev/null is globally redundant across almost every *nix-ish system in operation. Just reinstall your software on whatever is convenient and all the same data will be there.

mpyne|4 months ago

    sudo mknod /dev/null c 1 3 && sudo chmod 666 /dev/null
might do it on many systems

brunoborges|4 months ago

I get the joke, but IMO it doesn't pass Durability test, as what is sent to it (i.e. transactions) are not durable.

Durability in ACID is about the durability of the data that is sent to the database (in this ironic post, /dev/null) once committed.

"[...] completed transactions (or their effects) are recorded [...]"

But I will give it that ACI do make sense!

#PedanticMode

PTOB|4 months ago

Let's test that:

1. Nothing stored in /dev/null is durable. 2. Nothing is stored in /dev/null. 3. Ergo, /dev/null exhibits durability.

Thank you, I'll take my check at the door.

theandrewbailey|4 months ago

/dev/null is the ultimate storageless function. It's like serverless, but for PII, and deployable anywhere!

hshdhdhehd|4 months ago

It is also local first, low latency, data residency compliant, SOC2 compliant, zero dependency and webscale.

schonfinkel|4 months ago

Does it have sharding? I heard sharding is the secret sauce for webscale.

yard2010|4 months ago

I love vacously truths (not sure if this is how you say it in English)

All the people I've met in London were androids.

tczMUFlmoNk|4 months ago

The term is correct. Grammatically, we would say, "I love vacuous truths", or, "I love vacuously true statements". (To my ear the second version sounds very slightly more appropriate, because in mathematics "vacuously true" is a bit of a set phrase, but both are fine.)

1970-01-01|4 months ago

So if you could somehow get something stuck in /dev/null would it cause a panic or what happens?

bitwize|4 months ago

Yes, but does it support sharding? Sharding is the secret ingredient in the web scale sauce.

idontwantthis|4 months ago

This reminds me of how I would write a HashCode implementation on intro CS exams in college:

‘return 5’

raggi|4 months ago

rollcat|4 months ago

I understand this is supposed to be satire, but IMHO a well-executed joke should still be well-written and easy to follow. This "<statement> unless <condition>" is just terrible to read, and I can't even tell if FFI is necessary here, or a part of the joke. Funny not funny.

novoreorx|4 months ago

What a weird title, you can say it's ACID but it's not a database

sevg|4 months ago

> What a weird title, you can say it's ACID but it's not a database

You’re right, we should ban jokes that aren’t 100% correct!

gunalx|4 months ago

You say it is always empty, but. I have seen weird issues coming from /dev/null not actually being empty but being a file or symlink (dont remember) With garbage data.

yuppiemephisto|4 months ago

And the axiom of empty set is an inaccessible cardinal axiom

HackerThemAll|4 months ago

That article is a stinky brain fart that happens when you think you're having a moment of genius at 2:00 am.

dzogchen|4 months ago

It's ACID compliant yes, but it is not a database.

sph|4 months ago

It's ACID compliant. But it's not a database.

ozim|4 months ago

W just need R&D money to solve reading back from it, but that's just a matter of time we can definitely solve it in a year or two.

This tech is just around the corner I promise, then we will be first to the market and all the big tech companies will want to buy us out, imagine how much we can earn.

/s

torcete|4 months ago

I was reading on the information paradox on black holes. I wonder if the same paradox applies to /dev/null :-D

keithnz|4 months ago

took a while to pipe my multi-terabyte db to /dev/null but now that I have I'm saving a ton of money on storage.

dheera|4 months ago

I guess /dev/null is also an excellent source of investment advice, you are guaranteed to not lose money

taftster|4 months ago

Ah, how cute. An actual "old school" blog. Nostalgia. Tears in eyes.

https://jyu.dev/blog/

And the production of articles is about right too.

    . "Hello World" - The start of something great. [Dec 2024]

    . "Comparison is the Thief of Joy" - Link to another article. [Apr 2025]

    . "/dev/null is an ACID compliant database" - Funny, insightful. [Aug 2025]
That read about like my blog 20 years ago.

Funny post though, good read!

DeathArrow|4 months ago

More than that, /dev/null is infinitely scalable.

johnfn|4 months ago

Not only that, it provides all 3 components of CAP!

_joel|4 months ago

The Jespsen tests pass quickly too!

BiraIgnacio|4 months ago

A strong business opportunity right there.

layer8|4 months ago

Not on Windows.

munchlax|4 months ago

You could emulate it. Open windows, throw everything out, close it.

zdw|4 months ago

The RSS feed on this site is broken.

justinhj|4 months ago

Add an mcp server and I'm in

amai|4 months ago

Can it rollback transactions?

tonyhart7|4 months ago

it looks promising but what about AI /dev/null usage????

senfiaj|4 months ago

The author is a genius. If Amazon used /dev/null instead of DynamoDB, we would not experience such terrible outages.

luckystarr|4 months ago

Now make an algebra out of the CAP theorem. It's not already one, isn't it? Didn't read the paper.

Perz1val|4 months ago

Don't forget to feed your void. `dd if=/dev/zero of=/dev/null bs=500M count=1`

ramon156|4 months ago

I'm gonna be that guy, tyop at the bottom

> entreprise

QuiCasseRien|4 months ago

Fast and easy to read, funny and fuckingly true !

best post of the week ^^

charcircuit|4 months ago

/dev/null is not a database. By this logic is a hard disk a database, is a CD a database. No. They are storage mediums. You could store a database on them, but they themselves are not a database.

Considering there is no way to read back data written to /dev/null it will not be useful for storing database data.

jonathrg|4 months ago

You can store any data as long as it doesn't contain any ones

chrisweekly|4 months ago

seems you've missed the joke

sevg|4 months ago

[deleted]