Skip to content

Instantly share code, notes, and snippets.

@xvedejas
Created February 4, 2015 08:07
Show Gist options
  • Save xvedejas/2e1812985c2f4a11a76d to your computer and use it in GitHub Desktop.
Save xvedejas/2e1812985c2f4a11a76d to your computer and use it in GitHub Desktop.
Distributed FS calculator
#!/usr/bin/python
# RAID/Distributed FS calculator
# Some notes on designing a distributed FS cluster:
# - The total space on each machine (each OSD) should be nearly equal.
# - Larger drives for the same space means more redundancy but also slower
# rebuild times.
# - Entire RAID arrays are allowed to fail if the replication policy is > 1.
# Just don't let multiple RAID arrays fail at once.
### Input values ###
machines = 3
parity_drives_per_machine = 2 # (RAID6)
drives_per_machine = 12
# in TB, size of each drive.
drive_size = 1.5
# in USD, cost of each drive.
drive_cost = 80
# must be >= 2 to be able to take a machine down without interruption
avg_replication_count = 2.5
years_to_drive_failure = 6
####################
n_drives = drives_per_machine * machines
n_nonparity_drives = (drives_per_machine - parity_drives_per_machine) * machines
total_size = n_drives * drive_size
usable_size = (n_nonparity_drives * drive_size) / avg_replication_count
print("\n")
print("Physical size of system:\t", total_size)
print("Usable size of system:\t\t", usable_size)
print("Percent Utilization:\t\t", (usable_size / total_size) * 100)
print("\n")
print("Number of replicants we can take down and still read:")
print("\tWith WaR1 policy:\t", machines - 1)
print("\tWith WqRq policy:\t", machines // 2 if machines > 2 else 0)
print("Number of replicants we can take down and still write:")
print("\tWith WaR1 policy:\t", 0)
print("\tWith WqRq policy:\t", machines // 2 if machines > 2 else 0)
print("\n")
failure_rate = n_drives / years_to_drive_failure
print("Number of harddrives bought each year:\t", failure_rate)
print("Cash spent on harddrives each year:\t", failure_rate * drive_cost)
print("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment