Skip to content
  • Stefano Garzarella's avatar
    d7ddd0a1
    linux-aio: limit the batch size using `aio-max-batch` parameter · d7ddd0a1
    Stefano Garzarella authored
    
    
    When there are multiple queues attached to the same AIO context,
    some requests may experience high latency, since in the worst case
    the AIO engine queue is only flushed when it is full (MAX_EVENTS) or
    there are no more queues plugged.
    
    Commit 2558cb8d ("linux-aio: increasing MAX_EVENTS to a larger
    hardcoded value") changed MAX_EVENTS from 128 to 1024, to increase
    the number of in-flight requests. But this change also increased
    the potential maximum batch to 1024 elements.
    
    When there is a single queue attached to the AIO context, the issue
    is mitigated from laio_io_unplug() that will flush the queue every
    time is invoked since there can't be others queue plugged.
    
    Let's use the new `aio-max-batch` IOThread parameter to mitigate
    this issue, limiting the number of requests in a batch.
    
    We also define a default value (32): this value is obtained running
    some benchmarks and it represents a good tradeoff between the latency
    increase while a request is queued and the cost of the io_submit(2)
    system call.
    
    Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Message-id: 20210721094211.69853-4-sgarzare@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    d7ddd0a1
    linux-aio: limit the batch size using `aio-max-batch` parameter
    Stefano Garzarella authored
    
    
    When there are multiple queues attached to the same AIO context,
    some requests may experience high latency, since in the worst case
    the AIO engine queue is only flushed when it is full (MAX_EVENTS) or
    there are no more queues plugged.
    
    Commit 2558cb8d ("linux-aio: increasing MAX_EVENTS to a larger
    hardcoded value") changed MAX_EVENTS from 128 to 1024, to increase
    the number of in-flight requests. But this change also increased
    the potential maximum batch to 1024 elements.
    
    When there is a single queue attached to the AIO context, the issue
    is mitigated from laio_io_unplug() that will flush the queue every
    time is invoked since there can't be others queue plugged.
    
    Let's use the new `aio-max-batch` IOThread parameter to mitigate
    this issue, limiting the number of requests in a batch.
    
    We also define a default value (32): this value is obtained running
    some benchmarks and it represents a good tradeoff between the latency
    increase while a request is queued and the cost of the io_submit(2)
    system call.
    
    Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Message-id: 20210721094211.69853-4-sgarzare@redhat.com
    Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Loading