Repository: netty/netty
File: transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringIoHandlerConfig.java (Java)

Code before:
 *   <caption>Available Configuration Options</caption>
 *   <thead>
 *     <tr>
 *       <th>Setter Method</th>
 *       <th>Description</th>
 *     </tr>
 *   </thead>
 *   <tbody>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setRingSize}</td>
 *       <td>Sets the size of the submission queue for the io_uring instance.</td>
 *     </tr>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setMaxBoundedWorker}</td>
 *       <td>Defines the maximum number of bounded io_uring worker threads.</td>
 *     </tr>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setMaxUnboundedWorker}</td>
 *       <td>Defines the maximum number of unbounded io_uring worker threads.
 *        <br>
 *        If you use FileRegion to perform `sendfile` operations in io_uring,
 *        it is recommended to properly configure this option.
 *        <br>
 *        see:
 *        <br>
 *        https://github.com/netty/netty/issues/15125
 *       </td>
 *     </tr>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setBufferRingConfig}</td>
 *       <td>
 *         Adds a buffer ring configuration to the list of buffer ring configurations.
 *         It will be used to register the buffer ring for the io_uring instance.
 *       </td>
 *     </tr>
 *   </tbody>
 * </table>
 */

public final class IoUringIoHandlerConfig {
    private static final int DISABLE_SETUP_CQ_SIZE = -1;

    private int ringSize = Native.DEFAULT_RING_SIZE;
    private int cqSize = DISABLE_SETUP_CQ_SIZE;

    private int maxBoundedWorker;

    private int maxUnboundedWorker;

    private Set<IoUringBufferRingConfig> bufferRingConfigs;


Review comment (suggestion):
```suggestion
 *        If you use FileRegion to perform `sendfile` operations in io_uring,
 *        it is recommended to properly configure this option as otherwise you might
 *        end up with an <a href="https://github.com/netty/netty/issues/15125>unexpected number of kernel threads</a>.
```

Code after:
 *   <caption>Available Configuration Options</caption>
 *   <thead>
 *     <tr>
 *       <th>Setter Method</th>
 *       <th>Description</th>
 *     </tr>
 *   </thead>
 *   <tbody>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setRingSize}</td>
 *       <td>Sets the size of the submission queue for the io_uring instance.
 *        <br>
 *        If you want to submit a large number of io_uring requests at once,
 *        it is recommended to properly configure this option.
 *        The default value is 4096, which is sufficient for most scenarios.
 *       </td>
 *     </tr>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setMaxBoundedWorker}</td>
 *       <td>Defines the maximum number of bounded io_uring worker threads.
 *        <br>
 *        If you extend io_uring-related file operations based on Netty,
 *        it is recommended to properly configure this option.
 *        For more details, refer to the
 *        <a href="https://man7.org/linux/man-pages/man3/io_uring_register_iowq_max_workers.3.html>
 *            manual.
 *        </a>
 *       </td>
 *     </tr>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setMaxUnboundedWorker}</td>
 *       <td>Defines the maximum number of unbounded io_uring worker threads.
 *        <br>
 *        If you use FileRegion to perform `sendfile` operations in io_uring,
 *        it is recommended to properly configure this option as otherwise you might
 *        end up with an <a href="https://github.com/netty/netty/issues/15125>unexpected number of kernel threads</a>.
 *       </td>
 *     </tr>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setCqSize}</td>
 *       <td>Sets the size of the completionQueue queue for the io_uring instance.
 *        <br>
 *        If your current kernel supports some multishot variants
 *        (such as IORING_RECV_MULTISHOT, IORING_ACCEPT_MULTISHOT) or IORING_RECVSEND_BUNDLE,
 *        and you want to handle more CQEs in a single syscall
 *        it is recommended to properly configure this option.
 *        The default value is twice the ring size, which is sufficient for most scenarios.
 *       </td>
 *     </tr>
 *     <tr>
 *       <td>{@link IoUringIoHandlerConfig#setBufferRingConfig}</td>