Browse Source

Add functions to calculate AFR for a cluster

tags/v0.5.1
Vitaliy Filippov 4 months ago
parent
commit
6852f299ae
2 changed files with 58 additions and 1 deletions
  1. +1
    -1
      README.md
  2. +57
    -0
      mon/afr.js

+ 1
- 1
README.md View File

@@ -200,7 +200,7 @@ Hardware configuration: 4 nodes, each with:
- 6x SATA SSD Intel D3-4510 3.84 TB
- 2x Xeon Gold 6242 (16 cores @ 2.8 GHz)
- 384 GB RAM
- 1x 25 GbE network interface (Mellanox ConnectX-4 LX)
- 1x 25 GbE network interface (Mellanox ConnectX-4 LX), connected to a Juniper QFX5200 switch

CPU powersaving was disabled. Both Vitastor and Ceph were configured with 2 OSDs per 1 SSD.



+ 57
- 0
mon/afr.js View File

@@ -0,0 +1,57 @@
// Functions to calculate Annualized Failure Rate of your cluster
// if you know AFR of your drives, number of drives, expected rebalance time
// and replication factor
// License: VNPL-1.0 (see README.md for details)

module.exports = {
cluster_afr,
failure_rate,
c_n_k,
};

console.log(100*cluster_afr(100, 0.03, 10, 3), '%');
console.log(100*cluster_afr(1000, 0.03, 1, 3), '%');
console.log(100*cluster_afr(5, 0.1, 1, 2), '%');
console.log(100*cluster_afr(14, 0.01, 1, 2), '%');
console.log(100*cluster_afr(100, 0.03, 1, 2), '%');

// Estimate AFR of the cluster (not taking failure domains into account)
// n - number of drives
// afr - annualized failure rate of a single drive
// l - expected rebalance time in days after a single drive failure
// k - replication factor / number of drives that must fail at the same time for the cluster to fail
function cluster_afr(n, afr, l, k)
{
let p = 0;
for (let i = 0; i < n-(k-1); i++)
{
p += afr * (1-afr)**i * failure_rate(n-i-1, afr*l/365, k-1);
}
return p;
}

// Probability of at least <f> failures in a cluster with <n> drives with AFR=<a>
function failure_rate(n, a, f)
{
if (f <= 0)
{
return (1-a)**n;
}
let p = 1;
for (let i = 0; i < f; i++)
{
p -= c_n_k(n, i) * (1-a)**(n-i) * a**i;
}
return p;
}

// Combination count
function c_n_k(n, k)
{
let r = 1;
for (let i = 0; i < k; i++)
{
r *= (n-i) / (i+1);
}
return r;
}

Loading…
Cancel
Save