Navigation Menu

Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Jun 20, 2019
1 parent d0ca931 commit 5b5fc40
Show file tree
Hide file tree
Showing 14 changed files with 271 additions and 208 deletions.
30 changes: 16 additions & 14 deletions README.md
Expand Up @@ -150,15 +150,16 @@ benchmarks:
# Benchmark a container named nginx using POST HTTP verb using http://localhost:port/bozo URL and headers.
concurrency: 1
requests: 10000
path: /bozo
method: POST
body:
{"fred":"blee"}
header:
Accept:
- text/html
Content-Type:
- application/json
http:
path: /bozo
method: POST
body:
{"fred":"blee"}
header:
Accept:
- text/html
Content-Type:
- application/json
services:
# Similary you can Benchmark an HTTP service exposed either via nodeport, loadbalancer types.
# Service ID is ns/svc-name
Expand All @@ -167,11 +168,12 @@ benchmarks:
concurrency: 5
# Issues a total of 500 requests
requests: 500
method: GET
# This setting will depend on whether service is nodeport or loadbalancer. Nodeport may require vendor port tuneling setting.
# Set this to a node if nodeport or LB if applicable. IP or dns name.
host: 10.11.13.14
path: /bumblebeetuna
http:
method: GET
# This setting will depend on whether service is nodeport or loadbalancer. Nodeport may require vendor port tuneling setting.
# Set this to a node if nodeport or LB if applicable. IP or dns name.
host: 10.11.13.14
path: /bumblebeetuna
auth:
user: jean-baptiste-emmanuel
password: Zorg!
Expand Down
17 changes: 11 additions & 6 deletions internal/config/bench.go
Expand Up @@ -37,18 +37,23 @@ type (
N int `yaml:"requests"`
}

// BenchConfig represents a service benchmark.
BenchConfig struct {
C int `yaml:"concurrency"`
N int `yaml:"requests"`
// HTTP represents an http request.
HTTP struct {
Method string `yaml:"method"`
Host string `yaml:"host"`
Path string `yaml:"path"`
HTTP2 bool `yaml:"http2"`
Body string `yaml:"body"`
Auth Auth `yaml:"auth"`
Headers http.Header `yaml:"headers"`
Name string
}

// BenchConfig represents a service benchmark.
BenchConfig struct {
C int `yaml:"concurrency"`
N int `yaml:"requests"`
Auth Auth `yaml:"auth"`
HTTP HTTP `yaml:"http"`
Name string
}
)

Expand Down
24 changes: 12 additions & 12 deletions internal/config/bench_test.go
Expand Up @@ -104,13 +104,13 @@ func TestBenchServiceLoad(t *testing.T) {
svc := b.Benchmarks.Services[u.key]
assert.Equal(t, u.c, svc.C)
assert.Equal(t, u.n, svc.N)
assert.Equal(t, u.method, svc.Method)
assert.Equal(t, u.host, svc.Host)
assert.Equal(t, u.path, svc.Path)
assert.Equal(t, u.http2, svc.HTTP2)
assert.Equal(t, u.body, svc.Body)
assert.Equal(t, u.method, svc.HTTP.Method)
assert.Equal(t, u.host, svc.HTTP.Host)
assert.Equal(t, u.path, svc.HTTP.Path)
assert.Equal(t, u.http2, svc.HTTP.HTTP2)
assert.Equal(t, u.body, svc.HTTP.Body)
assert.Equal(t, u.auth, svc.Auth)
assert.Equal(t, u.headers, svc.Headers)
assert.Equal(t, u.headers, svc.HTTP.Headers)
})
}
}
Expand Down Expand Up @@ -174,13 +174,13 @@ func TestBenchContainerLoad(t *testing.T) {
co := b.Benchmarks.Containers[u.key]
assert.Equal(t, u.c, co.C)
assert.Equal(t, u.n, co.N)
assert.Equal(t, u.method, co.Method)
assert.Equal(t, u.host, co.Host)
assert.Equal(t, u.path, co.Path)
assert.Equal(t, u.http2, co.HTTP2)
assert.Equal(t, u.body, co.Body)
assert.Equal(t, u.method, co.HTTP.Method)
assert.Equal(t, u.host, co.HTTP.Host)
assert.Equal(t, u.path, co.HTTP.Path)
assert.Equal(t, u.http2, co.HTTP.HTTP2)
assert.Equal(t, u.body, co.HTTP.Body)
assert.Equal(t, u.auth, co.Auth)
assert.Equal(t, u.headers, co.Headers)
assert.Equal(t, u.headers, co.HTTP.Headers)
})
}
}
98 changes: 51 additions & 47 deletions internal/config/test_assets/b_containers.yml
Expand Up @@ -6,69 +6,73 @@ benchmarks:
c1:
concurrency: 2
requests: 1000
method: GET
http2: true
host: 10.10.10.10
path: /duh
body: |-
{"fred": "blee"}
http:
method: GET
http2: true
host: 10.10.10.10
path: /duh
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
headers:
Accept:
- text/html
Content-Type:
- application/json
c2:
concurrency: 10
requests: 1500
method: POST
http2: false
host: 20.20.20.20
path: /fred
body: |-
{"fred": "blee"}
http:
method: POST
http2: false
host: 20.20.20.20
path: /fred
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
headers:
Accept:
- text/html
Content-Type:
- application/json
services:
default/nginx:
concurrency: 2
requests: 1000
method: GET
http2: true
host: 10.10.10.10
path: /
body: |-
{"fred": "blee"}
http:
method: GET
http2: true
host: 10.10.10.10
path: /
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
headers:
Accept:
- text/html
Content-Type:
- application/json
blee/fred:
concurrency: 10
requests: 1500
method: POST
http2: false
host: 20.20.20.20
path: /blee
body: |-
{"fred": "blee"}
auth:
user: "fred"
password: "blee"
headers:
Accept:
- text/html
Content-Type:
- application/json
http:
method: POST
http2: false
host: 20.20.20.20
path: /blee
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
88 changes: 46 additions & 42 deletions internal/config/test_assets/b_containers_1.yml
Expand Up @@ -6,69 +6,73 @@ benchmarks:
c1:
concurrency: 2
requests: 1000
method: GET
http2: true
host: 10.10.10.10
path: /duh
body: |-
{"fred": "blee"}
auth:
user: "fred"
password: "blee"
http:
method: GET
http2: true
host: 10.10.10.10
path: /duh
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
c2:
concurrency: 10
requests: 1500
method: POST
http2: false
host: 20.20.20.20
path: /fred
body: |-
{"fred": "blee"}
http:
method: POST
http2: false
host: 20.20.20.20
path: /fred
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
headers:
Accept:
- text/html
Content-Type:
- application/json
services:
default/nginx:
concurrency: 2
requests: 1000
method: GET
http2: true
host: 10.10.10.10
path: /
body: |-
{"fred": "blee"}
http:
method: GET
http2: true
host: 10.10.10.10
path: /
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
headers:
Accept:
- text/html
Content-Type:
- application/json
blee/fred:
concurrency: 10
requests: 1500
method: POST
http2: false
host: 20.20.20.20
path: /blee
body: |-
{"fred": "blee"}
http:
method: POST
http2: false
host: 20.20.20.20
path: /blee
body: |-
{"fred": "blee"}
headers:
Accept:
- text/html
Content-Type:
- application/json
auth:
user: "fred"
password: "blee"
headers:
Accept:
- text/html
Content-Type:
- application/json

0 comments on commit 5b5fc40

Please sign in to comment.