mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-24 16:17:11 +08:00
* benchmark package
* use default config if path is not specified
* progressiveBench as a config method
* implement a main.go approach to run progressive tests
* make teleport client, run specified benchmark
* function and method descriptions
* make teleport client
* testing
* change interface method signatures
* dry up bench.go code, move producer goroutines to own function
* output formatting
* remove yaml
* fix linter errors
* remove print
* PR suggested changes, moved export latency profile functionality to the benchmark package
* PR fixes
* method description
* update testing
* linter
* docs and example
* PR suggestion changes
* fix coord omission bug
* remove benchmark struct
* remove threads, using open system
* recover in run
* close channel, check if open with each execution
* update testing, pr suggestions
* add more instructions to readme
* update example.go
* pass back context
* use SyncBuffer
* export response and service histograms
* update readme, exporting profiles section
* return from execute()
* export singular latency profile
* export response profile
* Revert "export response profile"
This reverts commit 5a21cb034c.
* export response profile
* update branch
* format example.go
* remove threads
* update example.go
* update branch
* goimports
* add signal handler & update docs
* PR suggestions
* exit out of interactive session
* revert execute
* PR suggestion
* run commmand on non-interactive instead of nil
57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
/*
|
|
Copyright 2020 Gravitational, 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.
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/gravitational/teleport/lib/benchmark"
|
|
)
|
|
|
|
func main() {
|
|
linear := &benchmark.Linear{
|
|
LowerBound: 10,
|
|
UpperBound: 50,
|
|
Step: 10,
|
|
MinimumMeasurements: 1000,
|
|
MinimumWindow: 30 * time.Second,
|
|
}
|
|
|
|
// Run Linear generator
|
|
results, err := benchmark.Run(context.TODO(), linear, "ls -l /", "host", "username", "teleport.example.com")
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
for i, res := range results {
|
|
fmt.Printf("Benchmark #%v\n", i+1)
|
|
fmt.Printf("Duration: %v\n", res.Duration)
|
|
fmt.Printf("Requests Originated: %v\n", res.RequestsOriginated)
|
|
fmt.Printf("Requests Failed: %v\n", res.RequestsFailed)
|
|
}
|
|
|
|
// Export latency profile
|
|
responseHistogram := results[0].Histogram
|
|
_, err = benchmark.ExportLatencyProfile("profiles/", responseHistogram, 1, 1.0)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
}
|