Documentation ¶
Overview ¶
The loadtest package implements running performance benchmarking against the apiserver. It can be used to benchmark upload and download performance. Benchmarking can be run as:
- a one-time test issuing user directed upload/download volume to the apiserver
- a continuous test repeatedly issuing user direct upload/download volume to the apiserver
- as an http service accepting http requests to place one-time or continuous upload/download volume on the server
Performance metrics (p50, p95 of read/write latencies, etc.) are appended to a temp file. (The location of the temp file is printed when the test is run.)
The methods in http_api.go implement the http endpoints:
(GET) /apiserver_test - returns the status (job running, waiting to start, etc.)
(GET) /apiserver_test?action=<upload/download>&... - starts a load test Note: using POST to start a test would be better aligned with REST philosophy, but then we would have to pass the test arguments in on the body of the request when we are using curl, making the curl experience more klunky. Thus we are using GET to trigger a test.
(GET) apiserver_test/kill - kills the current running test
Index ¶
- Constants
- Variables
- type ApiserverLoadTester
- func (lt *ApiserverLoadTester) GetStatus() Status
- func (lt *ApiserverLoadTester) KillTest()
- func (lt *ApiserverLoadTester) ResetStatsFile() error
- func (lt *ApiserverLoadTester) RunLoadTest() error
- func (lt *ApiserverLoadTester) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (lt *ApiserverLoadTester) StartHttpServer(host string, port string) error
- type Args
- type Status
- type StatusCode
Constants ¶
const ( UploadLatency = "write_latency" DownloadLatency = "read_latency" BatchUploadLatency = "batch_write_latency" BatchDownloadLatency = "batch_read_latency" KBYTE = 1024 MaxTestSize = 2000000000 // 2gb max data size for a test )
Variables ¶
var TestDataSizes = [3]int{1, 10, 1000} // these sizes are 1kb units: 1kb, 10kb, 1m test files
var TestDataSizesStr = strings.Trim(strings.Join(strings.Fields(fmt.Sprint(TestDataSizes)), ","), "[]")
Functions ¶
This section is empty.
Types ¶
type ApiserverLoadTester ¶
type ApiserverLoadTester struct {
// contains filtered or unexported fields
}
ApiserverLoadTester is the object that runs the load test. The RunLoadTest() function starts the load test.
func MakeApiserverLoadTester ¶
func MakeApiserverLoadTester(a *Args) *ApiserverLoadTester
func (*ApiserverLoadTester) GetStatus ¶
func (lt *ApiserverLoadTester) GetStatus() Status
GetStatus returns the current state of the test.
func (*ApiserverLoadTester) KillTest ¶
func (lt *ApiserverLoadTester) KillTest()
Trigger kill action.
func (*ApiserverLoadTester) ResetStatsFile ¶
func (lt *ApiserverLoadTester) ResetStatsFile() error
func (*ApiserverLoadTester) RunLoadTest ¶
func (lt *ApiserverLoadTester) RunLoadTest() error
Start the load test
func (*ApiserverLoadTester) ServeHTTP ¶
func (lt *ApiserverLoadTester) ServeHTTP(w http.ResponseWriter, r *http.Request)
Process the /apiserver_test and /apiserver_test/kill service endpoints.
Example requests:
- $ curl localhost:8080/apiserver_test?action=download&max_data_size=1000&min_data_size=10&num_times=20
- $ curl localhost:8080/apiserver_test
- $ curl localhost:8080/apiserver_test/kill
func (*ApiserverLoadTester) StartHttpServer ¶
func (lt *ApiserverLoadTester) StartHttpServer(host string, port string) error
Start the HTTP service.
type StatusCode ¶
type StatusCode int
const ( WaitingToStart StatusCode = iota Initializing InitUpload CreatingGoRoutines RunningActions PauseBetweenIterations )
func (StatusCode) String ¶
func (sc StatusCode) String() string
Directories ¶
Path | Synopsis |
---|---|
apiserver_benchmarker is the cli for generating load on the apiserver.
|
apiserver_benchmarker is the cli for generating load on the apiserver. |