Now that we live in the Big Data, Web 3.14159 era, lots of people want to build databases that are too big to fit on a single machine. But there's a problem in the form of the CAP theorem, which states that if your network ever partitions (a machine goes down, or part of the network loses its connection to the rest) then you can keep consistency (all machines return the same answer to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, fetchFromGitHub, conf ? null, patches | |
, libxcb, xcbutilkeysyms, xcbutilwm | |
, libX11, writeText, xcbutil, xcbutilxrm }: | |
with stdenv.lib; | |
stdenv.mkDerivation rec { | |
version = "0.2"; | |
name = "2bwm-${version}"; |
Or: functor? I 'ardly know 'er!
Monads are difficult to explain without sounding either patronizing or condescending: I would sound patronizing if I came up with some facile analogy and I would be condescending to describe it categorically.
Instead, I'll frame a problem and piece-by-piece solve the problem with what will turn out to be a monad.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extremely hacky server program that will send a standard response | |
// to every client that connects, then closes the connection. Will | |
// issue no system calls (as measured by `strace`) after initial setup | |
// no matter how many requests are served. | |
// Yes, this program is sorely lacking in error checking. It's a toy | |
// and not meant to be taken seriously. | |
// compile with gcc no_syscall_server.c -luring |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs