sim

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2019 License: MIT Imports: 26 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CollectionName = "examples"

CollectionName -

View Source
var SimDBName = fmt.Sprintf("_KEYHOLE_%X", 1024+1024*rand.Intn(1024))

SimDBName - db name for simulation

Functions

func GetSchemaFromCollection

func GetSchemaFromCollection(client *mongo.Client, dbName string, collection string) (string, error)

GetSchemaFromCollection returns a masked first doc of a collection

func PopulateData

func PopulateData(uri string, sslCAFile string, sslPEMKeyFile string) error

PopulateData - Insert docs to evaluate performance/bandwidth

{
	favorites: {
		sports: []
		cities: []
	}
	favoriteSports: []
	favoriteSports1
	favoriteSports2
	favoriteSports3
}

func PrintAllStats

func PrintAllStats(docs []mdb.ServerStatusDoc, span int) string

PrintAllStats print all stats

Types

type BuildInfo

type BuildInfo struct {
	Version string `json:"version" bson:"version"`
}

BuildInfo -

type CPUMetrics

type CPUMetrics struct {
	IdleMS    int64 `json:"idle_ms" bson:"idle_ms"`
	IOWaitMS  int64 `json:"iowait_ms" bson:"iowait_ms"`
	NiceMS    int64 `json:"nice_ms" bson:"nice_ms"`
	SoftirqMS int64 `json:"softirq_ms" bson:"softirq_ms"`
	StealMS   int64 `json:"steal_ms" bson:"steal_ms"`
	SystemMS  int64 `json:"system_ms" bson:"system_ms"`
	UserMS    int64 `json:"user_ms" bson:"user_ms"`
	TotalMS   int64
}

CPUMetrics -

type DiagnosticData

type DiagnosticData struct {
	ServerInfo        interface{}
	ServerStatusList  []mdb.ServerStatusDoc
	ReplSetStatusList []mdb.ReplSetStatusDoc
	SystemMetricsList []SystemMetricsDoc
	// contains filtered or unexported fields
}

DiagnosticData -

func NewDiagnosticData

func NewDiagnosticData(span int) *DiagnosticData

NewDiagnosticData -

func (*DiagnosticData) DecodeDiagnosticData added in v1.1.1

func (d *DiagnosticData) DecodeDiagnosticData(filenames []string) error

DecodeDiagnosticData decodes FTDC data files

func (*DiagnosticData) PrintDiagnosticData

func (d *DiagnosticData) PrintDiagnosticData(filenames []string) (string, error)

PrintDiagnosticData prints diagnostic data of MongoD

type DiagnosticDoc

type DiagnosticDoc struct {
	Start            time.Time            `json:"start" bson:"start"`
	ServerStatus     mdb.ServerStatusDoc  `json:"serverStatus" bson:"serverStatus"`
	ReplSetGetStatus mdb.ReplSetStatusDoc `json:"replSetGetStatus" bson:"replSetGetStatus"`
	SystemMetrics    SystemMetricsDoc     `json:"systemMetrics" bson:"systemMetrics"`
	End              time.Time            `json:"end" bson:"end"`
}

DiagnosticDoc -

type DiskMetrics

type DiskMetrics struct {
	ReadTimeMS  int64 `json:"read_time_ms" bson:"read_time_ms"`
	WriteTimeMS int64 `json:"write_time_ms" bson:"write_time_ms"`
	IO          int64
	IOQueuedMS  int64 `json:"io_queued_ms" bson:"io_queued_ms"`
	IOTimeMS    int64 `json:"io_time_ms" bson:"io_time_ms"`
	Reads       int64 `json:"reads" bson:"reads"`
	Writes      int64 `json:"writes" bson:"writes"`
}

DiskMetrics -

type Feeder

type Feeder struct {
	// contains filtered or unexported fields
}

Feeder seeds feeder

func NewFeeder

func NewFeeder() *Feeder

NewFeeder establish seeding parameters

func (*Feeder) SeedAllDemoData

func (f *Feeder) SeedAllDemoData(client *mongo.Client)

SeedAllDemoData - seed data for demo

 models: {
   "_id": string
  "name": string,
  "description": string
  "year": integer
}
robots: {
  "_id": string
  "modelId": string
  "notes": string,
  "batteryPct": float,
  "tasks": [{"for": string, "minutesUsed": integer}]
}

func (*Feeder) SeedCars

func (f *Feeder) SeedCars(client *mongo.Client)

SeedCars seeds cars collection

func (*Feeder) SeedData

func (f *Feeder) SeedData(client *mongo.Client) error

SeedData seeds all demo data

func (*Feeder) SeedFavorites

func (f *Feeder) SeedFavorites(client *mongo.Client)

SeedFavorites seeds demo data of collection favorites

func (*Feeder) SetCollection

func (f *Feeder) SetCollection(collection string)

SetCollection set collection

func (*Feeder) SetDatabase

func (f *Feeder) SetDatabase(database string)

SetDatabase set database

func (*Feeder) SetFile

func (f *Feeder) SetFile(file string)

SetFile set file

func (*Feeder) SetIsDrop

func (f *Feeder) SetIsDrop(isDrop bool)

SetIsDrop set isDrop

func (*Feeder) SetShowProgress

func (f *Feeder) SetShowProgress(showProgress bool)

SetShowProgress set showProgress

func (*Feeder) SetTotal

func (f *Feeder) SetTotal(total int)

SetTotal set total

type HostInfo

type HostInfo struct {
	OS     OSDoc     `json:"os" bson:"os"`
	System SystemDoc `json:"system" bson:"system"`
}

HostInfo -

type Model

type Model struct {
	ID          string `json:"_id" bson:"_id"`
	Name        string
	Description string
	Year        int
}

Model - robot model

type OSDoc

type OSDoc struct {
	Name    string `json:"name" bson:"name"`
	Type    string `json:"type" bson:"type"`
	Version string `json:"version" bson:"version"`
}

OSDoc -

type Robot

type Robot struct {
	ID         string  `json:"_id" bson:"_id"`
	ModelID    string  `json:"modelId,omitempty" bson:"modelId,omitempty"`
	Notes      string  `json:"notes" bson:"notes"`
	BatteryPct float32 `json:"batteryPct,omitempty" bson:"batteryPct,omitempty"`
	Tasks      []Task  `json:"tasks" bson:"tasks"`
}

Robot -

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner -

func NewRunner

func NewRunner(uri string, sslCAFile string, sslPEMKeyFile string) (*Runner, error)

NewRunner - Constructor

func (*Runner) Cleanup

func (rn *Runner) Cleanup() error

Cleanup drops the temp database

func (*Runner) CollectDBStats

func (rn *Runner) CollectDBStats(client *mongo.Client, channel chan string, dbName string, uri string)

CollectDBStats collects dbStats every 10 seconds

func (*Runner) CollectServerStatus

func (rn *Runner) CollectServerStatus(uri string, channel chan string)

CollectServerStatus collects db.serverStatus() every minute

func (*Runner) CreateIndexes

func (rn *Runner) CreateIndexes(docs []bson.M) error

CreateIndexes creates indexes

func (*Runner) PrintServerStatus

func (rn *Runner) PrintServerStatus(uri string, span int) (string, error)

PrintServerStatus prints serverStatusDocs summary for the duration

func (*Runner) ReplSetGetStatus

func (rn *Runner) ReplSetGetStatus(uri string, channel chan string)

ReplSetGetStatus collects {replSetGetStatus: 1} every minute

func (*Runner) SetDropFirstMode

func (rn *Runner) SetDropFirstMode(mode bool)

SetDropFirstMode -

func (*Runner) SetMonitorMode

func (rn *Runner) SetMonitorMode(mode bool)

SetMonitorMode -

func (*Runner) SetNumberConnections

func (rn *Runner) SetNumberConnections(num int)

SetNumberConnections -

func (*Runner) SetPeekMode

func (rn *Runner) SetPeekMode(mode bool)

SetPeekMode -

func (*Runner) SetSimOnlyMode

func (rn *Runner) SetSimOnlyMode(mode bool)

SetSimOnlyMode -

func (*Runner) SetSimulationDuration

func (rn *Runner) SetSimulationDuration(duration int)

SetSimulationDuration -

func (*Runner) SetTPS

func (rn *Runner) SetTPS(tps int)

SetTPS set transaction per second

func (*Runner) SetTemplateFilename

func (rn *Runner) SetTemplateFilename(filename string)

SetTemplateFilename -

func (*Runner) SetTransactionTemplateFilename

func (rn *Runner) SetTransactionTemplateFilename(filename string)

SetTransactionTemplateFilename -

func (*Runner) SetVerbose

func (rn *Runner) SetVerbose(verbose bool)

SetVerbose -

func (*Runner) Simulate

func (rn *Runner) Simulate(duration int, transactions []Transaction, thread int)

Simulate simulates CRUD for load tests

func (*Runner) Start

func (rn *Runner) Start() error

Start process requests

type ServerInfoDoc

type ServerInfoDoc struct {
	HostInfo  HostInfo  `json:"hostInfo" bson:"hostInfo"`
	BuildInfo BuildInfo `json:"buildInfo" bson:"buildInfo"`
}

ServerInfoDoc -

type SystemDoc

type SystemDoc struct {
	CPUArch   string `json:"cpuArch" bson:"cpuArch"`
	Hostname  string `json:"hostname" bson:"hostname"`
	NumCores  int    `json:"numCores" bson:"numCores"`
	MemSizeMB int    `json:"memSizeMB" bson:"memSizeMB"`
}

SystemDoc -

type SystemMetricsDoc

type SystemMetricsDoc struct {
	Start time.Time              `json:"start" bson:"start"`
	CPU   CPUMetrics             `json:"cpu" bson:"cpu"`
	Disks map[string]DiskMetrics `json:"disks" bson:"disks"`
}

SystemMetricsDoc -

type Task

type Task struct {
	For         string `json:"for" bson:"for"`
	MinutesUsed int    `json:"minutesUsed" bson:"minutesUsed"`
}

Task - robot task

type Transaction

type Transaction struct {
	C      string   `json:"c"`
	Filter bson.M   `json:"filter"`
	Op     bson.M   `json:"op"`
	Pipe   []bson.M `json:"pipe"`
}

Transaction -

type TransactionDoc

type TransactionDoc struct {
	Transactions []Transaction `json:"transactions" bson:"transactions"`
	Indexes      []bson.M      `json:"indexes" bson:"indexes"`
}

TransactionDoc -

func GetTransactions

func GetTransactions(filename string) TransactionDoc

GetTransactions -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL