Skip to content

Instantly share code, notes, and snippets.

@am2222
am2222 / BeaconResearch.md
Created October 6, 2016 21:42
iBeacon / Beacon Research
@ept
ept / dataloss.rb
Created January 24, 2017 22:17
Calculate the probability of losing all replicas of a partition in a cluster
# Parameters:
prob_nodefail = 0.001 # Probability of a single node failing
replication_factor = 3 # Number of copies of each partition (r)
partitions_per_node = 256 # Number of partitions per node
max_nodes = 10000 # Maximum number of nodes to consider
# (n - r)! / n! == r! / (n choose r)
# Intuitively: the fraction of the n! possible permutations of n nodes that
# results in the replicas of one particular partition to be mapped to three
# particular nodes, in a particular order.