Documentation
¶
Overview ¶
Copyright (c) 2014 Couchbase, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func CreateIndexDDL(solution *Solution) string
- func ExecuteRebalance(clusterUrl string, topologyChange service.TopologyChange, masterId string, ...) (map[string]*common.TransferToken, error)
- func ExecuteRebalanceInternal(clusterUrl string, topologyChange service.TopologyChange, masterId string, ...) (map[string]*common.TransferToken, error)
- func NewSimulator() *simulator
- func ParseMemoryStr(mem string) (int64, error)
- func ValidateSolution(s *Solution) error
- type BucketSpec
- type CollectionSpec
- type CommandType
- type ConstraintMethod
- type CostMethod
- type IndexSpec
- type IndexUsage
- func (o *IndexUsage) GetCpuUsage(useLive bool) float64
- func (o *IndexUsage) GetDisplayName() string
- func (o *IndexUsage) GetMemOverhead(useLive bool) uint64
- func (o *IndexUsage) GetMemTotal(useLive bool) uint64
- func (o *IndexUsage) GetMemUsage(useLive bool) uint64
- func (o *IndexUsage) String() string
- type IndexerConstraint
- func (c *IndexerConstraint) CanAddIndex(s *Solution, n *IndexerNode, u *IndexUsage) ViolationCode
- func (c *IndexerConstraint) CanAddNode(s *Solution) bool
- func (c *IndexerConstraint) CanSwapIndex(sol *Solution, n *IndexerNode, s *IndexUsage, t *IndexUsage) ViolationCode
- func (c *IndexerConstraint) GetCpuQuota() uint64
- func (c *IndexerConstraint) GetMemQuota() uint64
- func (c *IndexerConstraint) GetViolations(s *Solution, eligibles []*IndexUsage) *Violations
- func (c *IndexerConstraint) Print()
- func (c *IndexerConstraint) SatisfyClusterConstraint(s *Solution, eligibles []*IndexUsage) bool
- func (c *IndexerConstraint) SatisfyClusterResourceConstraint(s *Solution) bool
- func (c *IndexerConstraint) SatisfyIndexHAConstraint(s *Solution, n *IndexerNode, source *IndexUsage, eligibles []*IndexUsage) bool
- func (c *IndexerConstraint) SatisfyIndexHAConstraintAt(s *Solution, n *IndexerNode, offset int, source *IndexUsage, ...) bool
- func (c *IndexerConstraint) SatisfyNodeConstraint(s *Solution, n *IndexerNode, eligibles []*IndexUsage) bool
- func (c *IndexerConstraint) SatisfyNodeHAConstraint(s *Solution, n *IndexerNode, eligibles []*IndexUsage) bool
- func (c *IndexerConstraint) SatisfyNodeResourceConstraint(s *Solution, n *IndexerNode) bool
- func (c *IndexerConstraint) SatisfyServerGroupConstraint(s *Solution, u *IndexUsage, group string) bool
- func (c *IndexerConstraint) Validate(s *Solution) error
- type IndexerNode
- func (o *IndexerNode) AddCpuUsage(s *Solution, usage float64)
- func (o *IndexerNode) AddMemUsageOverhead(s *Solution, usage uint64, overhead uint64)
- func (o *IndexerNode) GetCpuUsage(useLive bool) float64
- func (o *IndexerNode) GetMemOverhead(useLive bool) uint64
- func (o *IndexerNode) GetMemTotal(useLive bool) uint64
- func (o *IndexerNode) GetMemUsage(useLive bool) uint64
- func (o *IndexerNode) GetMovedIndex() []*IndexUsage
- func (o *IndexerNode) IsDeleted() bool
- func (o *IndexerNode) MarkDeleted()
- func (o *IndexerNode) String() string
- func (o *IndexerNode) SubtractCpuUsage(s *Solution, usage float64)
- func (o *IndexerNode) SubtractMemUsageOverhead(s *Solution, usage uint64, overhead uint64)
- type LocalIndexMetadata
- type MOISizingMethod
- func (s *MOISizingMethod) ComputeIndexOverhead(idx *IndexUsage) uint64
- func (s *MOISizingMethod) ComputeIndexSize(idx *IndexUsage)
- func (s *MOISizingMethod) ComputeIndexerOverhead(o *IndexerNode)
- func (s *MOISizingMethod) ComputeIndexerSize(o *IndexerNode)
- func (s *MOISizingMethod) ComputeMinQuota(indexes []*IndexUsage, useLive bool) (uint64, uint64)
- func (s *MOISizingMethod) Validate(solution *Solution) error
- type PlacementMethod
- type Plan
- type Planner
- type RandomPlacement
- func (p *RandomPlacement) Add(s *Solution, indexes []*IndexUsage)
- func (p *RandomPlacement) AddOptionalIndexes(indexes []*IndexUsage)
- func (p *RandomPlacement) GetEligibleIndexes() []*IndexUsage
- func (p *RandomPlacement) HasOptionalIndexes() bool
- func (p *RandomPlacement) InitialPlace(s *Solution, indexes []*IndexUsage)
- func (p *RandomPlacement) Move(s *Solution) (bool, bool, bool)
- func (p *RandomPlacement) RemoveEligibleIndex(indexes []*IndexUsage)
- func (p *RandomPlacement) RemoveOptionalIndexes()
- func (p *RandomPlacement) Validate(s *Solution) error
- type RunConfig
- type RunStats
- type SAPlanner
- type SizingMethod
- type Solution
- func ExecutePlanWithOptions(plan *Plan, indexSpecs []*IndexSpec, detail bool, genStmt string, ...) (*Solution, error)
- func ExecuteRebalanceWithOptions(plan *Plan, indexSpecs []*IndexSpec, detail bool, genStmt string, ...) (*Solution, error)
- func ExecuteSwapWithOptions(plan *Plan, detail bool, genStmt string, output string, addNode int, ...) (*Solution, error)
- func (s *Solution) ComputeCpuUsage() (float64, float64)
- func (s *Solution) ComputeEmptyIndexDistribution() (float64, float64)
- func (s *Solution) ComputeMemUsage() (float64, float64)
- func (s *Solution) FindIndexerWithReplica(name string, bucket string, replicaId int) *IndexerNode
- func (s *Solution) PrintLayout()
- func (s *Solution) PrintStats()
- func (s *Solution) UseLiveData() bool
- type UsageBasedCostMethod
- type Violation
- type ViolationCode
- type Violations
- type WorkloadSpec
Constants ¶
const ( IterationPerTemp int = 1000 ResizePerIteration int = 1000 RunPerPlan int = 10 MaxTemperature float64 = 1.0 MinTemperature float64 = 0.00001 Alpha float64 = 0.90 MinNumMove int64 = 1 MinNumPositiveMove int64 = 1 )
constant - simulated annealing
const ( MOIMutationRatePerCore uint64 = 25000 MOIScanRatePerCore = 5000 MOIScanTimeout = 120 )
constant - index sizing - MOI
const ( CommandPlan CommandType = "plan" CommandRebalance = "rebalance" CommandSwap = "swap" )
const ( NoViolation ViolationCode = "NoViolation" MemoryViolation = "MemoryViolation" CpuViolation = "CpuViolation" ReplicaViolation = "ReplicaViolation" EquivIndexViolation = "EquivIndexViolation" ServerGroupViolation = "ServerGroupViolation" DeleteNodeViolation = "DeleteNodeViolation" )
Variables ¶
This section is empty.
Functions ¶
func CreateIndexDDL ¶
CREATE INDEX [index_name] ON named_keyspace_ref( expression [ , expression ] * )
WHERE filter_expressions [ USING GSI | VIEW ] [ WITH { "nodes": [ "node_name" ], "defer_build":true|false } ];
BUILD INDEX ON named_keyspace_ref(index_name[,index_name]*) USING GSI;
func ExecuteRebalance ¶
func ExecuteRebalance(clusterUrl string, topologyChange service.TopologyChange, masterId string, ejectOnly bool, disableReplicaRepair bool) (map[string]*common.TransferToken, error)
func NewSimulator ¶
func NewSimulator() *simulator
func ParseMemoryStr ¶
Convert memory string from string to int
Types ¶
type BucketSpec ¶
type BucketSpec struct { Name string `json:"name,omitempty"` Replica int64 `json:"replica,omitempty"` Workload []*CollectionSpec `json:"workload,omitempty"` Distribution []int64 `json:"distribution,omitempty"` }
type CollectionSpec ¶
type CollectionSpec struct { Name string `json:"name,omitempty"` MinNumDoc int64 `json:"minNumDoc,omitempty"` MaxNumDoc int64 `json:"maxNumDoc,omitempty"` MinDocKeySize int64 `json:"minDocKeySize,omitempty"` MaxDocKeySize int64 `json:"maxDocKeySize,omitempty"` MinSecKeySize int64 `json:"minSecKeySize,omitempty"` MaxSecKeySize int64 `json:"maxSecKeySize,omitempty"` MinArrKeySize int64 `json:"minArrKeySize,omitempty"` MaxArrKeySize int64 `json:"maxArrKeySize,omitempty"` MinArrSize int64 `json:"minArrSize,omitempty"` MaxArrSize int64 `json:"maxArrSize,omitempty"` MinMutationRate int64 `json:"minMutationRate,omitempty"` MaxMutationRate int64 `json:"maxMutationRate,omitempty"` MinScanRate int64 `json:"minScanRate,omitempty"` MaxScanRate int64 `json:"maxScanRate,omitempty"` }
type ConstraintMethod ¶
type ConstraintMethod interface { GetMemQuota() uint64 GetCpuQuota() uint64 SatisfyClusterResourceConstraint(s *Solution) bool SatisfyNodeResourceConstraint(s *Solution, n *IndexerNode) bool SatisfyNodeHAConstraint(s *Solution, n *IndexerNode, eligibles []*IndexUsage) bool SatisfyIndexHAConstraint(s *Solution, n *IndexerNode, index *IndexUsage, eligibles []*IndexUsage) bool SatisfyClusterConstraint(s *Solution, eligibles []*IndexUsage) bool SatisfyNodeConstraint(s *Solution, n *IndexerNode, eligibles []*IndexUsage) bool SatisfyServerGroupConstraint(s *Solution, n *IndexUsage, group string) bool CanAddIndex(s *Solution, n *IndexerNode, u *IndexUsage) ViolationCode CanSwapIndex(s *Solution, n *IndexerNode, t *IndexUsage, i *IndexUsage) ViolationCode CanAddNode(s *Solution) bool Print() Validate(s *Solution) error GetViolations(s *Solution, indexes []*IndexUsage) *Violations }
type CostMethod ¶
type IndexSpec ¶
type IndexSpec struct { // definition Name string `json:"name,omitempty"` Bucket string `json:"bucket,omitempty"` IsPrimary bool `json:"isPrimary,omitempty"` SecExprs []string `json:"secExprs,omitempty"` WhereExpr string `json:"where,omitempty"` Deferred bool `json:"deferred,omitempty"` Immutable bool `json:"immutable,omitempty"` IsArrayIndex bool `json:"isArrayIndex,omitempty"` // usage Replica uint64 `json:"replica,omitempty"` NumDoc uint64 `json:"numDoc,omitempty"` DocKeySize uint64 `json:"docKeySize,omitempty"` SecKeySize uint64 `json:"secKeySize,omitempty"` ArrKeySize uint64 `json:"arrKeySize,omitempty"` ArrSize uint64 `json:"arrSize,omitempty"` MutationRate uint64 `json:"mutationRate,omitempty"` ScanRate uint64 `json:"scanRate,omitempty"` }
func ReadIndexSpecs ¶
type IndexUsage ¶
type IndexUsage struct { // input: index identification DefnId common.IndexDefnId `json:"defnId"` InstId common.IndexInstId `json:"instId"` Name string `json:"name"` Bucket string `json:"bucket"` Hosts []string `json:"host"` // input: index sizing IsPrimary bool `json:"isPrimary,omitempty"` IsMOI bool `json:"isMOI,omitempty"` AvgSecKeySize uint64 `json:"avgSecKeySize"` AvgDocKeySize uint64 `json:"avgDocKeySize"` AvgArrSize uint64 `json:"avgArrSize"` AvgArrKeySize uint64 `json:"avgArrKeySize"` NumOfDocs uint64 `json:"numOfDocs"` MemResidentRatio uint64 `json:"memResidentRatio,omitempty"` MutationRate uint64 `json:"mutationRate"` ScanRate uint64 `json:"scanRate"` // input: resource consumption (from sizing) MemUsage uint64 `json:"memUsage"` CpuUsage float64 `json:"cpuUsage"` DiskUsage uint64 `json:"diskUsage,omitempty"` MemOverhead uint64 `json:"memOverhead,omitempty"` // input: resource consumption (from live cluster) ActualMemUsage uint64 `json:"actualMemUsage"` ActualMemOverhead uint64 `json:"actualMemOverhead"` ActualKeySize uint64 `json:"actualKeySize"` ActualCpuUsage float64 `json:"actualCpuUsage"` NoUsage bool `json:"NoUsage"` // input: index definition (optional) Instance *common.IndexInst `json:"instance,omitempty"` // contains filtered or unexported fields }
func ConvertToIndexUsage ¶
func ConvertToIndexUsage(defn *common.IndexDefn, localMeta *LocalIndexMetadata) (*IndexUsage, error)
This function convert a single index defintion to IndexUsage.
func ConvertToIndexUsages ¶
func ConvertToIndexUsages(localMeta *LocalIndexMetadata, node *IndexerNode) ([]*IndexUsage, error)
This function convert index defintions from a single metadatda repository to a list of IndexUsage.
func (*IndexUsage) GetCpuUsage ¶
func (o *IndexUsage) GetCpuUsage(useLive bool) float64
Get cpu usage
func (*IndexUsage) GetDisplayName ¶
func (o *IndexUsage) GetDisplayName() string
func (*IndexUsage) GetMemOverhead ¶
func (o *IndexUsage) GetMemOverhead(useLive bool) uint64
Get memory overhead
func (*IndexUsage) GetMemTotal ¶
func (o *IndexUsage) GetMemTotal(useLive bool) uint64
Get total memory
func (*IndexUsage) GetMemUsage ¶
func (o *IndexUsage) GetMemUsage(useLive bool) uint64
Get memory usage
func (*IndexUsage) String ¶
func (o *IndexUsage) String() string
This function returns a string representing the index
type IndexerConstraint ¶
type IndexerConstraint struct { // system level constraint MemQuota uint64 `json:"memQuota,omitempty"` CpuQuota uint64 `json:"cpuQuota,omitempty"` MaxMemUse int64 `json:"maxMemUse,omitempty"` MaxCpuUse int64 `json:"maxCpuUse,omitempty"` // contains filtered or unexported fields }
func (*IndexerConstraint) CanAddIndex ¶
func (c *IndexerConstraint) CanAddIndex(s *Solution, n *IndexerNode, u *IndexUsage) ViolationCode
This function determines if an index can be placed into the given node, while satsifying availability and resource constraint.
func (*IndexerConstraint) CanAddNode ¶
func (c *IndexerConstraint) CanAddNode(s *Solution) bool
Allow Add Node
func (*IndexerConstraint) CanSwapIndex ¶
func (c *IndexerConstraint) CanSwapIndex(sol *Solution, n *IndexerNode, s *IndexUsage, t *IndexUsage) ViolationCode
This function determines if an index can be swapped with another index in the given node, while satsifying availability and resource constraint.
func (*IndexerConstraint) GetCpuQuota ¶
func (c *IndexerConstraint) GetCpuQuota() uint64
Get cpu quota
func (*IndexerConstraint) GetMemQuota ¶
func (c *IndexerConstraint) GetMemQuota() uint64
Get memory quota
func (*IndexerConstraint) GetViolations ¶
func (c *IndexerConstraint) GetViolations(s *Solution, eligibles []*IndexUsage) *Violations
Return an error with a list of violations
func (*IndexerConstraint) SatisfyClusterConstraint ¶
func (c *IndexerConstraint) SatisfyClusterConstraint(s *Solution, eligibles []*IndexUsage) bool
This function determines if cluster wide constraint is satisifed.
func (*IndexerConstraint) SatisfyClusterResourceConstraint ¶
func (c *IndexerConstraint) SatisfyClusterResourceConstraint(s *Solution) bool
This function determines if cluster wide constraint is satisifed.
func (*IndexerConstraint) SatisfyIndexHAConstraint ¶
func (c *IndexerConstraint) SatisfyIndexHAConstraint(s *Solution, n *IndexerNode, source *IndexUsage, eligibles []*IndexUsage) bool
This function determines if a HA constraint is satisfied for a particular index in indexer node.
func (*IndexerConstraint) SatisfyIndexHAConstraintAt ¶
func (c *IndexerConstraint) SatisfyIndexHAConstraintAt(s *Solution, n *IndexerNode, offset int, source *IndexUsage, eligibles []*IndexUsage) bool
func (*IndexerConstraint) SatisfyNodeConstraint ¶
func (c *IndexerConstraint) SatisfyNodeConstraint(s *Solution, n *IndexerNode, eligibles []*IndexUsage) bool
This function determines if a node constraint is satisfied.
func (*IndexerConstraint) SatisfyNodeHAConstraint ¶
func (c *IndexerConstraint) SatisfyNodeHAConstraint(s *Solution, n *IndexerNode, eligibles []*IndexUsage) bool
This function determines if a node HA constraint is satisfied.
func (*IndexerConstraint) SatisfyNodeResourceConstraint ¶
func (c *IndexerConstraint) SatisfyNodeResourceConstraint(s *Solution, n *IndexerNode) bool
This function determines if a node constraint is satisfied.
func (*IndexerConstraint) SatisfyServerGroupConstraint ¶
func (c *IndexerConstraint) SatisfyServerGroupConstraint(s *Solution, u *IndexUsage, group string) bool
Check replica server group
func (*IndexerConstraint) Validate ¶
func (c *IndexerConstraint) Validate(s *Solution) error
Validate the solution
type IndexerNode ¶
type IndexerNode struct { // input: node identification NodeId string `json:"nodeId"` NodeUUID string `json:"nodeUUID"` IndexerId string `json:"indexerId"` RestUrl string `json:"restUrl"` ServerGroup string `json:"serverGroup,omitempty"` StorageMode string `json:"storageMode,omitempty"` // input/output: resource consumption (from sizing) MemUsage uint64 `json:"memUsage"` CpuUsage float64 `json:"cpuUsage"` DiskUsage uint64 `json:"diskUsage,omitempty"` MemOverhead uint64 `json:"memOverhead"` // input/output: resource consumption (from live cluster) ActualMemUsage uint64 `json:"actualMemUsage"` ActualMemOverhead uint64 `json:"actualMemOverhead"` ActualCpuUsage float64 `json:"actualCpuUsage"` // input: index residing on the node Indexes []*IndexUsage `json:"indexes"` // contains filtered or unexported fields }
func CreateIndexerNodeWithIndexes ¶
func CreateIndexerNodeWithIndexes(nodeId string, sizing SizingMethod, indexes []*IndexUsage) *IndexerNode
This function creates a new indexer node. This function expects that each index is already "sized". If sizing method is provided, it will compute sizing for indexer as well.
func (*IndexerNode) AddCpuUsage ¶
func (o *IndexerNode) AddCpuUsage(s *Solution, usage float64)
Add Cpu
func (*IndexerNode) AddMemUsageOverhead ¶
func (o *IndexerNode) AddMemUsageOverhead(s *Solution, usage uint64, overhead uint64)
Add memory
func (*IndexerNode) GetCpuUsage ¶
func (o *IndexerNode) GetCpuUsage(useLive bool) float64
Get cpu usage
func (*IndexerNode) GetMemOverhead ¶
func (o *IndexerNode) GetMemOverhead(useLive bool) uint64
Get memory overhead
func (*IndexerNode) GetMemTotal ¶
func (o *IndexerNode) GetMemTotal(useLive bool) uint64
Get memory total
func (*IndexerNode) GetMemUsage ¶
func (o *IndexerNode) GetMemUsage(useLive bool) uint64
Get memory usage
func (*IndexerNode) GetMovedIndex ¶
func (o *IndexerNode) GetMovedIndex() []*IndexUsage
Get a list of index usages that are moved to this node
func (*IndexerNode) String ¶
func (o *IndexerNode) String() string
This function returns a string representing the indexer
func (*IndexerNode) SubtractCpuUsage ¶
func (o *IndexerNode) SubtractCpuUsage(s *Solution, usage float64)
Subtract Cpu
func (*IndexerNode) SubtractMemUsageOverhead ¶
func (o *IndexerNode) SubtractMemUsageOverhead(s *Solution, usage uint64, overhead uint64)
Add memory
type LocalIndexMetadata ¶
type LocalIndexMetadata struct { IndexerId string `json:"indexerId,omitempty"` NodeUUID string `json:"nodeUUID,omitempty"` StorageMode string `json:"storageMode,omitempty"` IndexTopologies []client.IndexTopology `json:"topologies,omitempty"` IndexDefinitions []common.IndexDefn `json:"definitions,omitempty"` }
type MOISizingMethod ¶
type MOISizingMethod struct { }
func (*MOISizingMethod) ComputeIndexOverhead ¶
func (s *MOISizingMethod) ComputeIndexOverhead(idx *IndexUsage) uint64
This function estimates the index memory overhead
func (*MOISizingMethod) ComputeIndexSize ¶
func (s *MOISizingMethod) ComputeIndexSize(idx *IndexUsage)
This function computes the index size
func (*MOISizingMethod) ComputeIndexerOverhead ¶
func (s *MOISizingMethod) ComputeIndexerOverhead(o *IndexerNode)
This function computes the indexer memory overhead
func (*MOISizingMethod) ComputeIndexerSize ¶
func (s *MOISizingMethod) ComputeIndexerSize(o *IndexerNode)
This function computes the indexer memory and cpu usage
func (*MOISizingMethod) ComputeMinQuota ¶
func (s *MOISizingMethod) ComputeMinQuota(indexes []*IndexUsage, useLive bool) (uint64, uint64)
This function estimates the min memory quota given a set of indexes
func (*MOISizingMethod) Validate ¶
func (s *MOISizingMethod) Validate(solution *Solution) error
Validate
type PlacementMethod ¶
type PlacementMethod interface { Move(s *Solution) (bool, bool, bool) Add(s *Solution, indexes []*IndexUsage) InitialPlace(s *Solution, indexes []*IndexUsage) Validate(s *Solution) error GetEligibleIndexes() []*IndexUsage AddOptionalIndexes([]*IndexUsage) RemoveOptionalIndexes() HasOptionalIndexes() bool RemoveEligibleIndex([]*IndexUsage) }
type Plan ¶
type Plan struct { // placement of indexes in nodes Placement []*IndexerNode `json:"placement,omitempty"` MemQuota uint64 `json:"memQuota,omitempty"` CpuQuota uint64 `json:"cpuQuota,omitempty"` IsLive bool `json:"isLive,omitempty"` }
func RetrievePlanFromCluster ¶
This function retrieves the index layout plan from a live cluster.
type Planner ¶
type Planner interface { Plan(indexers []*IndexerNode, indexes []*IndexUsage) *Solution Print() }
type RandomPlacement ¶
type RandomPlacement struct {
// contains filtered or unexported fields
}
func (*RandomPlacement) Add ¶
func (p *RandomPlacement) Add(s *Solution, indexes []*IndexUsage)
This function randomly place indexes among indexer nodes
func (*RandomPlacement) AddOptionalIndexes ¶
func (p *RandomPlacement) AddOptionalIndexes(indexes []*IndexUsage)
Add optional index for placement
func (*RandomPlacement) GetEligibleIndexes ¶
func (p *RandomPlacement) GetEligibleIndexes() []*IndexUsage
Get index for placement
func (*RandomPlacement) HasOptionalIndexes ¶
func (p *RandomPlacement) HasOptionalIndexes() bool
Is there any optional index for placement
func (*RandomPlacement) InitialPlace ¶
func (p *RandomPlacement) InitialPlace(s *Solution, indexes []*IndexUsage)
This function randomly place indexes among indexer nodes for initial placement
func (*RandomPlacement) Move ¶
func (p *RandomPlacement) Move(s *Solution) (bool, bool, bool)
Randomly select a single index to move to a different node
rebalance steps: 1) Find out index that are eligible to be moved
- swap rebalance: index on ejected node
- general rebalance: all index
- Move indexes from a ejected node to a "new" node (node with no index)
- If it is a simple swap (no. of ejected node == no. of new node), then stop.
- If there is still any ejected node left after step (2), move those indexes to any node. After this step, no index on ejected node.
- Perform general rebalance on eligible index. - For index with usage info, rebalance by minimizing usage variance. - For index with no usage info (e.g. deferred index), rebalance by round robin across nodes.
func (*RandomPlacement) RemoveEligibleIndex ¶
func (p *RandomPlacement) RemoveEligibleIndex(indexes []*IndexUsage)
Remove Eligible Index. It does not remove "optional eligible" index.
func (*RandomPlacement) RemoveOptionalIndexes ¶
func (p *RandomPlacement) RemoveOptionalIndexes()
Remove optional index for placement
type RunConfig ¶
type RunConfig struct { Detail bool GenStmt string MemQuotaFactor float64 CpuQuotaFactor float64 Resize bool MaxNumNode int Output string Shuffle int AllowMove bool AllowSwap bool AllowUnpin bool AddNode int DeleteNode int MaxMemUse int MaxCpuUse int MemQuota int64 CpuQuota int DataCostWeight float64 CpuCostWeight float64 MemCostWeight float64 EjectOnly bool DisableRepair bool }
func DefaultRunConfig ¶
func DefaultRunConfig() *RunConfig
type RunStats ¶
type RunStats struct { AvgIndexSize float64 StdDevIndexSize float64 AvgIndexCpu float64 StdDevIndexCpu float64 MemoryQuota uint64 CpuQuota uint64 IndexCount uint64 Initial_score float64 Initial_indexCount uint64 Initial_indexerCount uint64 Initial_avgIndexSize float64 Initial_stdDevIndexSize float64 Initial_avgIndexCpu float64 Initial_stdDevIndexCpu float64 Initial_avgIndexerSize float64 Initial_stdDevIndexerSize float64 Initial_avgIndexerCpu float64 Initial_stdDevIndexerCpu float64 Initial_movedIndex uint64 Initial_movedData uint64 }
type SAPlanner ¶
type SAPlanner struct { // result Result *Solution `json:"result,omitempty"` Score float64 `json:"score,omitempty"` ElapseTime uint64 `json:"elapsedTime,omitempty"` ConvergenceTime uint64 `json:"convergenceTime,omitempty"` Iteration uint64 `json:"iteration,omitempty"` Move uint64 `json:"move,omitempty"` PositiveMove uint64 `json:"positiveMove,omitempty"` StartTemp float64 `json:"startTemp,omitempty"` StartScore float64 `json:"startScore,omitempty"` Try uint64 `json:"try,omitempty"` // contains filtered or unexported fields }
func (*SAPlanner) Plan ¶
func (p *SAPlanner) Plan(command CommandType, solution *Solution) (*Solution, error)
Given a solution, this function use simulated annealing to find an alternative solution with a lower cost.
func (*SAPlanner) PrintCost ¶
func (p *SAPlanner) PrintCost()
This function prints the result of evaluation
func (*SAPlanner) PrintLayout ¶
func (p *SAPlanner) PrintLayout()
This function prints the result of evaluation
type SizingMethod ¶
type SizingMethod interface { ComputeIndexSize(u *IndexUsage) ComputeIndexerOverhead(n *IndexerNode) ComputeIndexerSize(n *IndexerNode) ComputeIndexOverhead(idx *IndexUsage) uint64 ComputeMinQuota(u []*IndexUsage, useLive bool) (uint64, uint64) Validate(s *Solution) error }
type Solution ¶
type Solution struct { // placement of indexes in nodes Placement []*IndexerNode `json:"placement,omitempty"` // contains filtered or unexported fields }
func ExecutePlanWithOptions ¶
func ExecuteSwapWithOptions ¶
func (*Solution) ComputeCpuUsage ¶
Compute statistics on cpu usage
func (*Solution) ComputeEmptyIndexDistribution ¶
Compute statistics on number of index. This only consider index that has no stats or sizing information.
func (*Solution) ComputeMemUsage ¶
Compute statistics on memory usage
func (*Solution) FindIndexerWithReplica ¶
func (s *Solution) FindIndexerWithReplica(name string, bucket string, replicaId int) *IndexerNode
Find the indexer node that contains the replica
func (*Solution) PrintLayout ¶
func (s *Solution) PrintLayout()
This prints out layout for the solution
func (*Solution) PrintStats ¶
func (s *Solution) PrintStats()
This prints the vital statistics from Solution.
func (*Solution) UseLiveData ¶
Whether solution should use live data
type UsageBasedCostMethod ¶
type UsageBasedCostMethod struct { MemMean float64 `json:"memMean,omitempty"` MemStdDev float64 `json:"memStdDev,omitempty"` CpuMean float64 `json:"cpuMean,omitempty"` CpuStdDev float64 `json:"cpuStdDev,omitempty"` TotalData uint64 `json:"totalData,omitempty"` DataMoved uint64 `json:"dataMoved,omitempty"` TotalIndex uint64 `json:"totalIndex,omitempty"` IndexMoved uint64 `json:"indexMoved,omitempty"` IdxMean float64 `json:"idxMean,omitempty"` IdxStdDev float64 `json:"idxStdDev,omitempty"` MemFree float64 `json:"memFree,omitempty"` CpuFree float64 `json:"cpuFree,omitempty"` // contains filtered or unexported fields }
func (*UsageBasedCostMethod) Cost ¶
func (c *UsageBasedCostMethod) Cost(s *Solution) float64
Compute cost based on variance on memory and cpu usage across indexers
func (*UsageBasedCostMethod) Validate ¶
func (c *UsageBasedCostMethod) Validate(s *Solution) error
Validate the solution
type Violations ¶
func (*Violations) Error ¶
func (v *Violations) Error() string
This function returns violations as a string
func (*Violations) IsEmpty ¶
func (v *Violations) IsEmpty() bool
This function returns if there is any violation
type WorkloadSpec ¶
type WorkloadSpec struct { Name string `json:"name,omitempty"` Comment string `json:"comment,omitempty"` Workload []*BucketSpec `json:"workload,omitempty"` Distribution []int64 `json:"distribution,omitempty"` MinNumIndex int64 `json:"minNumIndex,omitempty"` MaxNumIndex int64 `json:"maxNumIndex,omitempty"` }