fix: disable keep alive

This commit is contained in:
buyuxiang
2022-05-09 18:15:28 +08:00
parent 63af5ed55a
commit 8d8a658508
2 changed files with 6 additions and 3 deletions
+5 -3
View File
@@ -19,9 +19,6 @@ func NewBoomer(spawnCount int, spawnRate float64) *HRPBoomer {
} }
b.hrpRunner = NewRunner(nil) b.hrpRunner = NewRunner(nil)
// set client transport for high concurrency load testing
b.hrpRunner.SetClientTransport(b.GetSpawnCount(), b.GetDisableKeepAlive(), b.GetDisableCompression())
return b return b
} }
@@ -32,6 +29,11 @@ type HRPBoomer struct {
pluginsMutex *sync.RWMutex // avoid data race pluginsMutex *sync.RWMutex // avoid data race
} }
func (b *HRPBoomer) SetClientTransport() {
// set client transport for high concurrency load testing
b.hrpRunner.SetClientTransport(b.GetSpawnCount(), b.GetDisableKeepAlive(), b.GetDisableCompression())
}
// Run starts to run load test for one or multiple testcases. // Run starts to run load test for one or multiple testcases.
func (b *HRPBoomer) Run(testcases ...ITestCase) { func (b *HRPBoomer) Run(testcases ...ITestCase) {
event := sdk.EventTracking{ event := sdk.EventTracking{
+1
View File
@@ -41,6 +41,7 @@ var boomCmd = &cobra.Command{
} }
hrpBoomer.SetDisableKeepAlive(disableKeepalive) hrpBoomer.SetDisableKeepAlive(disableKeepalive)
hrpBoomer.SetDisableCompression(disableCompression) hrpBoomer.SetDisableCompression(disableCompression)
hrpBoomer.SetClientTransport()
hrpBoomer.EnableCPUProfile(cpuProfile, cpuProfileDuration) hrpBoomer.EnableCPUProfile(cpuProfile, cpuProfileDuration)
hrpBoomer.EnableMemoryProfile(memoryProfile, memoryProfileDuration) hrpBoomer.EnableMemoryProfile(memoryProfile, memoryProfileDuration)
hrpBoomer.EnableGracefulQuit() hrpBoomer.EnableGracefulQuit()