module Cryload::FdLimit

Overview

Guards against the most confusing failure mode of a load generator: running out of file descriptors mid-run and reporting a pile of transport errors that look like the target failing.

Extended Modules

Defined in:

cryload/fd_limit.cr

Constant Summary

HEADROOM = 64

Sockets plus stdio, DNS, and the report file the caller may be redirecting into. 64 is generous rather than exact on purpose.

Instance Method Summary

Instance Method Detail

def ensure(connections : Int32) : String | Nil #

Raises the soft limit toward the hard limit when needed. Returns nil when the process can open connections sockets, otherwise an actionable message for the caller to print before exiting with a config error.