Skip to content
Snippets Groups Projects
Commit d6be0775 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add two new variables in the cluster score

This patch adds two new variables to the cluster score:
  - variance of the failN1 attribute
  - variance of the reserved memory percentage

The variance of the failN1 helps make the cluster N+1 happy, whereas the
reserved memory percentage helps balance the unused memory for
redundancy on the nodes.
parent dfc749e6
No related branches found
No related tags found
No related merge requests found
......@@ -572,7 +572,7 @@ printNodes ktn nl =
in unlines $ map (uncurry helper) snl'
-- | Compute the mem and disk covariance.
compDetailedCV :: NodeList -> (Double, Double)
compDetailedCV :: NodeList -> (Double, Double, Double, Double)
compDetailedCV nl =
let
nodes = Container.elems nl
......@@ -580,18 +580,23 @@ compDetailedCV nl =
dsk_l = map Node.p_dsk nodes
mem_cv = varianceCoeff mem_l
dsk_cv = varianceCoeff dsk_l
in (mem_cv, dsk_cv)
n1_l = map (\n -> if Node.failN1 n then 1 else 0) nodes
n1_cv = varianceCoeff n1_l
res_l = map Node.p_rem nodes
res_cv = varianceCoeff res_l
in (mem_cv, dsk_cv, n1_cv, res_cv)
-- | Compute the 'total' variance.
compCV :: NodeList -> Double
compCV nl =
let (mem_cv, dsk_cv) = compDetailedCV nl
in mem_cv + dsk_cv
let (mem_cv, dsk_cv, n1_score, res_cv) = compDetailedCV nl
in mem_cv + dsk_cv + n1_score + res_cv
printStats :: NodeList -> String
printStats nl =
let (mem_cv, dsk_cv) = compDetailedCV nl
in printf "mem=%.8f, dsk=%.8f" mem_cv dsk_cv
let (mem_cv, dsk_cv, n1_score, res_cv) = compDetailedCV nl
in printf "f_mem=%.8f, r_mem=%.8f, f_dsk=%.8f, n1=%.3f"
mem_cv res_cv dsk_cv n1_score
-- Balancing functions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment