Tizen_4.0 base
[platform/upstream/docker-engine.git] / vendor / github.com / hashicorp / serf / coordinate / config.go
1 package coordinate
2
3 // Config is used to set the parameters of the Vivaldi-based coordinate mapping
4 // algorithm.
5 //
6 // The following references are called out at various points in the documentation
7 // here:
8 //
9 // [1] Dabek, Frank, et al. "Vivaldi: A decentralized network coordinate system."
10 //     ACM SIGCOMM Computer Communication Review. Vol. 34. No. 4. ACM, 2004.
11 // [2] Ledlie, Jonathan, Paul Gardner, and Margo I. Seltzer. "Network Coordinates
12 //     in the Wild." NSDI. Vol. 7. 2007.
13 // [3] Lee, Sanghwan, et al. "On suitability of Euclidean embedding for
14 //     host-based network coordinate systems." Networking, IEEE/ACM Transactions
15 //     on 18.1 (2010): 27-40.
16 type Config struct {
17         // The dimensionality of the coordinate system. As discussed in [2], more
18         // dimensions improves the accuracy of the estimates up to a point. Per [2]
19         // we chose 4 dimensions plus a non-Euclidean height.
20         Dimensionality uint
21
22         // VivaldiErrorMax is the default error value when a node hasn't yet made
23         // any observations. It also serves as an upper limit on the error value in
24         // case observations cause the error value to increase without bound.
25         VivaldiErrorMax float64
26
27         // VivaldiCE is a tuning factor that controls the maximum impact an
28         // observation can have on a node's confidence. See [1] for more details.
29         VivaldiCE float64
30
31         // VivaldiCC is a tuning factor that controls the maximum impact an
32         // observation can have on a node's coordinate. See [1] for more details.
33         VivaldiCC float64
34
35         // AdjustmentWindowSize is a tuning factor that determines how many samples
36         // we retain to calculate the adjustment factor as discussed in [3]. Setting
37         // this to zero disables this feature.
38         AdjustmentWindowSize uint
39
40         // HeightMin is the minimum value of the height parameter. Since this
41         // always must be positive, it will introduce a small amount error, so
42         // the chosen value should be relatively small compared to "normal"
43         // coordinates.
44         HeightMin float64
45
46         // LatencyFilterSamples is the maximum number of samples that are retained
47         // per node, in order to compute a median. The intent is to ride out blips
48         // but still keep the delay low, since our time to probe any given node is
49         // pretty infrequent. See [2] for more details.
50         LatencyFilterSize uint
51
52         // GravityRho is a tuning factor that sets how much gravity has an effect
53         // to try to re-center coordinates. See [2] for more details.
54         GravityRho float64
55 }
56
57 // DefaultConfig returns a Config that has some default values suitable for
58 // basic testing of the algorithm, but not tuned to any particular type of cluster.
59 func DefaultConfig() *Config {
60         return &Config{
61                 Dimensionality:       8,
62                 VivaldiErrorMax:      1.5,
63                 VivaldiCE:            0.25,
64                 VivaldiCC:            0.25,
65                 AdjustmentWindowSize: 20,
66                 HeightMin:            10.0e-6,
67                 LatencyFilterSize:    3,
68                 GravityRho:           150.0,
69         }
70 }