[tahoe-dev] Monte Carlo simulator for emergent reliability
zooko
zooko at zooko.com
Fri Sep 7 16:01:09 PDT 2007
Suppose you encode a file with K-out-of-N erasure coding, and you put
each of the N shares on a separate server, and your servers have an
average reliability of P.
What's the reliability of the file?
Here is a simple Monte Carlo simulator to answer that question:
#!/usr/bin/env python
import random
def r(k, n, p, tries=2**20):
"""
@param k: required shares
@param n: total shares
@param p: server reliability
@param tries: number of computrons to sacrifice to the Gods of
Monte Carlo in order to get an accurate answer
"""
succs = 0
i = 0
while i < tries:
ups = 0
for server in xrange(n):
if random.random() < p:
ups += 1
if ups >= k:
succs += 1
i += 1
return float(succs) / tries
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcknp.py
Type: text/x-python-script
Size: 536 bytes
Desc: not available
Url : http://allmydata.org/pipermail/tahoe-dev/attachments/20070907/5fb7cd15/attachment.bin
More information about the tahoe-dev
mailing list