为什么 /Dev/Null 是一个符合 ACID 要求的数据库
/dev/null is an ACID compliant database

原始链接: https://jyu.dev/blog/why-dev-null-is-an-acid-compliant-database/

## /dev/null:令人惊讶的强大数据库 `/dev/null` 提供了一种独特且可靠的数据库解决方案,完美符合ACID属性。它保证**原子性**——操作要么完全完成,要么完全不执行。**一致性**得以维持,因为它*始终*保持为空。**隔离性**是内在的,因为由于缺乏存储,并发写入永远不会冲突。最后,**持久性**确保数据(虽然是空无)永久提交,即使在系统故障后也是如此。 本质上,`/dev/null` 可以完美地处理并丢弃数据。 然而,有一个小小的限制:它的存储容量只有0字节。对于更大规模的“虚无”需求,请联系企业销售——目前由作者本人负责!

## /dev/null 作为数据库:一则 Hacker News 讨论 一则 Hacker News 帖子,关于 `/dev/null` 具有 ACID 兼容性,引发了一场幽默而富有洞察力的讨论。核心笑点在于,`/dev/null`(一个丢弃所有写入数据的特殊文件)在技术上*满足*某些数据库标准——始终一致、可用和分区容错,尽管方式非常简单。 用户分享了相关的项目,例如 `nocode`(一个故意为空的后端)和“PipeLogic”数据库概念。对话很快演变成一种有趣的夸大,评论者们开玩笑地称赞 `/dev/null` 的可扩展性、灾难恢复能力,甚至它通过 Jespen 测试的能力。许多人强调了它的可靠性——“无 bug 软件”——和低运营成本。 该帖子还涉及了维护故意损坏项目(如 `nocode`)的挑战,以及类似笑话在中国社交媒体上的意外病毒式传播。最终,这场讨论是对数据库概念的轻松探索,以及对简约但不太实用的解决方案的庆祝。
相关文章

原文

/

/dev/null is web scale

Atomicity

Operations are "all or nothing."

Anything you write to /dev/null disappears entirely. There's no partial write problem: it’s either written (and discarded) or not written at all. ✅

Consistency

The system transitions from one valid state to another.

/dev/null always stays in a consistent state (empty). No matter what you write, the invariant "file contains nothing" always holds. ✅

Isolation

Concurrent transactions don’t interfere with each other.

Multiple processes can write to /dev/null at the same time, and their outputs never conflict, because nothing is ever stored. ✅

Durability

Once a transaction is committed, it remains so, even after crashes.

/dev/null "durably" commits your data into nothingness. After a crash or reboot, it still contains exactly what it always has: nothing. ✅


There is only 1 small problem though, it only comes with 0b of free storage. For more space, you will have to contact entreprise sales, which is actually just me!

联系我们 contact @ memedata.com