There is also a down_out_interval

Vitaliy Filippov 2021-01-15 18:28:46 +03:00
parent 10b4e3e3d8
commit 4736ee725d
2 changed files with 11 additions and 11 deletions

20
afr.js
View File

@ -56,47 +56,47 @@ function failure_rate_fullmesh(n, a, f)
// is that, with k=2, total failure rate doesn't depend on number of peers per OSD,
// because it gets increased linearly by increased number of peers to fail
// and decreased linearly by reduced rebalance time.
function cluster_afr_pgs({ n_hosts, n_drives, afr_drive, capacity, speed, replicas, pgs = 1, osd_rm, degraded_replacement })
function cluster_afr_pgs({ n_hosts, n_drives, afr_drive, capacity, speed, replicas, pgs = 1, osd_rm, degraded_replacement, down_out_interval = 600 })
{
pgs = Math.min(pgs, (n_hosts-1)*n_drives/(replicas-1));
const resilver_disk = n_drives == 1 || osd_rm ? pgs : (n_drives-1);
const disk_heal_time = capacity/(degraded_replacement ? 1 : resilver_disk)/speed/86400/365;
const disk_heal_time = (down_out_interval + capacity/(degraded_replacement ? 1 : resilver_disk)/speed)/86400/365;
return 1 - (1 - afr_drive * (1-(1-(afr_drive*disk_heal_time)**(replicas-1))**pgs)) ** (n_hosts*n_drives);
}
function cluster_afr_pgs_ec({ n_hosts, n_drives, afr_drive, capacity, speed, ec: [ ec_data, ec_parity ], pgs = 1, osd_rm, degraded_replacement })
function cluster_afr_pgs_ec({ n_hosts, n_drives, afr_drive, capacity, speed, ec: [ ec_data, ec_parity ], pgs = 1, osd_rm, degraded_replacement, down_out_interval = 600 })
{
const ec_total = ec_data+ec_parity;
pgs = Math.min(pgs, (n_hosts-1)*n_drives/(ec_total-1));
const resilver_disk = n_drives == 1 || osd_rm ? pgs : (n_drives-1);
const disk_heal_time = capacity/(degraded_replacement ? 1 : resilver_disk)/speed/86400/365;
const disk_heal_time = (down_out_interval + capacity/(degraded_replacement ? 1 : resilver_disk)/speed)/86400/365;
return 1 - (1 - afr_drive * (1-(1-failure_rate_fullmesh(ec_total-1, afr_drive*disk_heal_time, ec_parity))**pgs)) ** (n_hosts*n_drives);
}
// Same as above, but also take server failures into account
function cluster_afr_pgs_hosts({ n_hosts, n_drives, afr_drive, afr_host, capacity, speed, replicas, pgs = 1, osd_rm, degraded_replacement })
function cluster_afr_pgs_hosts({ n_hosts, n_drives, afr_drive, afr_host, capacity, speed, replicas, pgs = 1, osd_rm, degraded_replacement, down_out_interval = 600 })
{
const otherhosts = Math.min(pgs, (n_hosts-1)/(replicas-1));
pgs = Math.min(pgs, (n_hosts-1)*n_drives/(replicas-1));
const resilver_disk = n_drives == 1 || osd_rm ? pgs : (n_drives-1);
const pgh = Math.min(pgs*n_drives, (n_hosts-1)*n_drives/(replicas-1));
const disk_heal_time = capacity/(degraded_replacement ? 1 : resilver_disk)/speed/86400/365;
const host_heal_time = n_drives*capacity/pgs/speed/86400/365;
const disk_heal_time = (down_out_interval + capacity/(degraded_replacement ? 1 : resilver_disk)/speed)/86400/365;
const host_heal_time = (down_out_interval + n_drives*capacity/pgs/speed)/86400/365;
const p1 = ((afr_drive+afr_host*pgs/otherhosts)*host_heal_time);
const p2 = ((afr_drive+afr_host*pgs/otherhosts)*disk_heal_time);
return 1 - ((1 - afr_host * (1-(1-p1**(replicas-1))**pgh)) ** n_hosts) *
((1 - afr_drive * (1-(1-p2**(replicas-1))**pgs)) ** (n_hosts*n_drives));
}
function cluster_afr_pgs_ec_hosts({ n_hosts, n_drives, afr_drive, afr_host, capacity, speed, ec: [ ec_data, ec_parity ], pgs = 1, osd_rm, degraded_replacement })
function cluster_afr_pgs_ec_hosts({ n_hosts, n_drives, afr_drive, afr_host, capacity, speed, ec: [ ec_data, ec_parity ], pgs = 1, osd_rm, degraded_replacement, down_out_interval = 600 })
{
const ec_total = ec_data+ec_parity;
const otherhosts = Math.min(pgs, (n_hosts-1)/(ec_total-1));
pgs = Math.min(pgs, (n_hosts-1)*n_drives/(ec_total-1));
const resilver_disk = n_drives == 1 || osd_rm ? pgs : (n_drives-1);
const pgh = Math.min(pgs*n_drives, (n_hosts-1)*n_drives/(ec_total-1));
const disk_heal_time = capacity/(degraded_replacement ? 1 : resilver_disk)/speed/86400/365;
const host_heal_time = n_drives*capacity/pgs/speed/86400/365;
const disk_heal_time = (down_out_interval + capacity/(degraded_replacement ? 1 : resilver_disk)/speed)/86400/365;
const host_heal_time = (down_out_interval + n_drives*capacity/pgs/speed)/86400/365;
const p1 = ((afr_drive+afr_host*pgs/otherhosts)*host_heal_time);
const p2 = ((afr_drive+afr_host*pgs/otherhosts)*disk_heal_time);
return 1 - ((1 - afr_host * (1-(1-failure_rate_fullmesh(ec_total-1, p1, ec_parity))**pgh)) ** n_hosts) *

View File

@ -67,7 +67,7 @@ class Calc extends preact.Component
format4 = (n) =>
{
let p = Math.abs(n-(n|0)), m = 10000;
while (p != 0 && p < 0.1)
while (n < 1 && p != 0 && p < 0.1)
{
p = p*10;
m = m*10;