Skip to content

Commit

Permalink
Merge pull request #200 from ddosify/develop
Browse files Browse the repository at this point in the history
fix invalid capacity bug for distinct user mode
  • Loading branch information
fatihbaltaci authored May 11, 2023
2 parents 048686a + d925b60 commit 7cd2eb4
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 11 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
35 changes: 26 additions & 9 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,42 +60,58 @@ var table = []struct {

testType TestType
}{
{
name: "config_distinct_user",
path: "config/config_testdata/benchmark/config_distinct_user.json",
cpuTimeThreshold: 0.350,
maxMemThreshold: 0.5,
avgMemThreshold: 0.35,
testType: Basic,
},
{
name: "config_repeated_user",
path: "config/config_testdata/benchmark/config_repeated_user.json",
cpuTimeThreshold: 0.350,
maxMemThreshold: 0.5,
avgMemThreshold: 0.35,
testType: Basic,
},
{
name: "config_correlation_load_1",
path: "config/config_testdata/benchmark/config_correlation_load_1.json",
cpuTimeThreshold: 0.350,
maxMemThreshold: 1,
avgMemThreshold: 1,
maxMemThreshold: 0.5,
avgMemThreshold: 0.35,
testType: Correlation,
},
{
name: "config_correlation_load_2",
path: "config/config_testdata/benchmark/config_correlation_load_2.json",
cpuTimeThreshold: 2.5,
maxMemThreshold: 2,
avgMemThreshold: 2,
maxMemThreshold: 0.8,
avgMemThreshold: 0.7,
testType: Correlation,
},
{
name: "config_correlation_load_3",
path: "config/config_testdata/benchmark/config_correlation_load_3.json",
cpuTimeThreshold: 15.5,
maxMemThreshold: 5,
avgMemThreshold: 8,
avgMemThreshold: 4,
testType: Correlation,
},
{
name: "config_correlation_load_4",
path: "config/config_testdata/benchmark/config_correlation_load_4.json",
cpuTimeThreshold: 25,
maxMemThreshold: 25,
avgMemThreshold: 16,
maxMemThreshold: 7,
avgMemThreshold: 5,
testType: Correlation,
},
{
name: "config_correlation_load_5",
path: "config/config_testdata/benchmark/config_correlation_load_5.json",
cpuTimeThreshold: 70,
cpuTimeThreshold: 60,
maxMemThreshold: 15,
avgMemThreshold: 10,
testType: Correlation,
Expand Down Expand Up @@ -134,7 +151,7 @@ var table = []struct {
{
name: "config_multipart_inject_1krps",
path: "config/config_testdata/benchmark/config_multipart_inject_1krps.json",
cpuTimeThreshold: 240,
cpuTimeThreshold: 180,
maxMemThreshold: 10,
avgMemThreshold: 15,
testType: Multipart,
Expand Down

0 comments on commit 7cd2eb4

Please sign in to comment.