Skip to content

Commit

Permalink
fix invalid capacity bug for distinct user mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kenanfarukcakir committed May 11, 2023
1 parent f835fec commit 1b01d60
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
25 changes: 25 additions & 0 deletions config/config_testdata/benchmark/config_distinct_user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"iteration_count": 100,
"engine_mode": "ddosify",
"load_type": "linear",
"duration": 10,
"steps": [
{
"id": 1,
"url": "{{HTTPBIN}}/json",
"name": "JSON",
"method": "GET",
"others": {
"h2": false,
"disable-redirect": true,
"disable-compression": false
}
}
],
"output": "stdout",
"env":{
"HTTPBIN" : "https://httpbin.ddosify.com"
},
"debug" : false,
"engine-mode": "distinct-user"
}
25 changes: 25 additions & 0 deletions config/config_testdata/benchmark/config_repeated_user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"iteration_count": 100,
"engine_mode": "ddosify",
"load_type": "linear",
"duration": 10,
"steps": [
{
"id": 1,
"url": "{{HTTPBIN}}/json",
"name": "JSON",
"method": "GET",
"others": {
"h2": false,
"disable-redirect": true,
"disable-compression": false
}
}
],
"output": "stdout",
"env":{
"HTTPBIN" : "https://httpbin.ddosify.com"
},
"debug" : false,
"engine-mode": "distinct-user"
}
4 changes: 2 additions & 2 deletions core/scenario/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ func (s *ScenarioService) Init(ctx context.Context, scenario types.Scenario,
initialCount = opts.MaxConcurrentIterCount
maxCount = opts.MaxConcurrentIterCount
} else if s.engineMode == types.EngineModeDistinctUser {
initialCount = opts.IterationCount
maxCount = opts.MaxConcurrentIterCount
initialCount = opts.MaxConcurrentIterCount
maxCount = opts.IterationCount
}
s.cPool, err = NewClientPool(initialCount, maxCount, s.engineMode, putInitialCookiesInJarFactory(s.engineMode, opts.InitialCookies), func(c *http.Client) { c.CloseIdleConnections() })
}
Expand Down
17 changes: 17 additions & 0 deletions main_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type TestType string
const (
Multipart TestType = "multipart"
Correlation TestType = "correlation"
Basic TestType = "basic"
)

var table = []struct {
Expand All @@ -59,6 +60,22 @@ var table = []struct {

testType TestType
}{
{
name: "config_distinct_user",
path: "config/config_testdata/benchmark/config_distinct_user.json",
cpuTimeThreshold: 0.350,
maxMemThreshold: 1,
avgMemThreshold: 1,
testType: Basic,
},
{
name: "config_repeated_user",
path: "config/config_testdata/benchmark/config_repeated_user.json",
cpuTimeThreshold: 0.350,
maxMemThreshold: 1,
avgMemThreshold: 1,
testType: Basic,
},
{
name: "config_correlation_load_1",
path: "config/config_testdata/benchmark/config_correlation_load_1.json",
Expand Down

0 comments on commit 1b01d60

Please sign in to comment.