Parameters for instantiating an IOCtx IO context.
Picking suitable parameters for high performance depends on the hardware that
is used and the workload of the program. There are benchmarks included in the
blockio-uring repository
that can help gauge the performance for a random 4k read workload, but some
trial and error with custom benchmarks might be required.
Ideally the concurrency limit should be a multiple of the batch size limit.
This should ensure that there can be multiple batches in flight at once. If
so, the SSD can more often than not pick up new I/O batches to perform as
soon as it has finished other batches.
Ideally the batch size limit should be equal to if not larger than the number
of I/O operations that an SSD can perform concurrently. This ensures that the
SSD can perform most if not all I/O operations in a batch concurrently.
Internally, each GHC capability in the program creates its own independent IO
context. These parameters apply separately to each capability's IO context.
For example, if the program runs with 2 capabilities, a batch size limit of
64, and a concurrency limit of 256, then each capability gets its own IO
context, and each IO context can process batches of at most 64 I/O operations
at a time, and each IO context can only process 4 such batches concurrently.
Constructors
IOCtxParamsioctxBatchSizeLimit :: !IntThe maximum size of a batch of I/O operations that can be processed as
a whole.
Note that his does not affect the size of batches of I/O operations
that can be submitted using submitIO. There is no restriction on the
size of batches submitted using submitIO. If the size of a batch that
is passed to submitIO exceeds this limit, then internally these batches
will split into sub-batches of size at most the limit, and each sub-batch
is processed individually.
ioctxConcurrencyLimit :: !IntThe total number of I/O operations that can be processed concurrently.
If a use of submitIO would lead to this limit being exceeded, then the
call to submitIO will block until enough I/O batches have been
processed.
ioctxIOWaitMetrics :: !BoolEnable or disable IOWAIT metrics
If io_uring_set_iowait(3) is available, then it will be called with
this value to either enable (True) or disable (False) IOWAIT
metrics. This is innocuous in terms of performance but changes how CPU
idle time is reported. io_uring_set_iowait(3) is available for
liburing versions >= 2.10 and Linux kernels versions >= 6.15.