feat(loadtest): sync add real 500-session capacity harness
This commit is contained in:
parent
ac0566f779
commit
141f2f20c4
39 changed files with 4157 additions and 42 deletions
21
internal/loadharness/process_limit_unix.go
Normal file
21
internal/loadharness/process_limit_unix.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
//go:build darwin || linux
|
||||
|
||||
package loadharness
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func validateProcessCapacity(sessions int) error {
|
||||
var limit unix.Rlimit
|
||||
if err := unix.Getrlimit(unix.RLIMIT_NOFILE, &limit); err != nil {
|
||||
return fmt.Errorf("read open-file limit: %w", err)
|
||||
}
|
||||
required := minimumOpenFiles(sessions)
|
||||
if limit.Cur < uint64(required) {
|
||||
return fmt.Errorf("open-file soft limit %d is below required %d for %d sessions; raise it before running the load", limit.Cur, required, sessions)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue