Skip to content

Commit

Permalink
Merge branch 'main' into timeout-remove
Browse files Browse the repository at this point in the history
  • Loading branch information
normanmaurer authored Jan 24, 2024
2 parents fa1d531 + b047cec commit c8b5294
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<checkstyle.version>8.38</checkstyle.version>
<junit.version>5.9.0</junit.version>
<netty.version>4.1.104.Final</netty.version>
<netty.version>4.1.106.Final</netty.version>
<netty-tcnative-boringssl-static.version>2.0.61.Final</netty-tcnative-boringssl-static.version>
<bouncycastle.version>1.68</bouncycastle.version>
<build-helper-maven-plugin.version>3.2.0</build-helper-maven-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ public IOUringEventLoopGroup(int nThreads) {
* Create a new instance using the default number of threads and the given {@link ThreadFactory}.
*/
public IOUringEventLoopGroup(ThreadFactory threadFactory) {
this(0, threadFactory, 0, Native.DEFAULT_IOSEQ_ASYNC_THRESHOLD);
this(0, threadFactory, 0, Native.DEFAULT_IOSQE_ASYNC_THRESHOLD);
}

/**
* Create a new instance using the specified number of threads and the given {@link ThreadFactory}.
*/
public IOUringEventLoopGroup(int nThreads, ThreadFactory threadFactory) {
this(nThreads, threadFactory, 0, Native.DEFAULT_IOSEQ_ASYNC_THRESHOLD);
this(nThreads, threadFactory, 0, Native.DEFAULT_IOSQE_ASYNC_THRESHOLD);
}

/**
* Create a new instance using the specified number of threads and the given {@link Executor}.
*/
public IOUringEventLoopGroup(int nThreads, Executor executor) {
this(nThreads, executor, 0, Native.DEFAULT_IOSEQ_ASYNC_THRESHOLD);
this(nThreads, executor, 0, Native.DEFAULT_IOSQE_ASYNC_THRESHOLD);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@
final class Native {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(Native.class);
static final int DEFAULT_RING_SIZE = Math.max(64, SystemPropertyUtil.getInt("io.netty.iouring.ringSize", 4096));
static final int DEFAULT_IOSEQ_ASYNC_THRESHOLD =
Math.max(0, SystemPropertyUtil.getInt("io.netty.iouring.iosqeAsyncThreshold", 25));
/**
* When there are more FDs (= connections) than this setting, the FDs will be marked as IOSQE_ASYNC, under the
* expectation that read/write ops on the FDs will usually block. If this expectation is correct, IOSQE_ASYNC can
* reduce CPU usage, but if the expectation is incorrect, it may add additional, unnecessary latency.
* <p>
* Default is to never use IOSQE_ASYNC.
*/
static final int DEFAULT_IOSQE_ASYNC_THRESHOLD =
Math.max(0, SystemPropertyUtil.getInt("io.netty.iouring.iosqeAsyncThreshold", Integer.MAX_VALUE));

static {
Selector selector = null;
Expand Down Expand Up @@ -195,7 +202,7 @@ public void run() {
(TCP_FASTOPEN_MODE & TFO_ENABLED_SERVER_MASK) == TFO_ENABLED_SERVER_MASK;

static RingBuffer createRingBuffer(int ringSize) {
return createRingBuffer(ringSize, DEFAULT_IOSEQ_ASYNC_THRESHOLD);
return createRingBuffer(ringSize, DEFAULT_IOSQE_ASYNC_THRESHOLD);
}

static RingBuffer createRingBuffer(int ringSize, int iosqeAsyncThreshold) {
Expand Down Expand Up @@ -232,7 +239,7 @@ static RingBuffer createRingBuffer(int ringSize, int iosqeAsyncThreshold) {
}

static RingBuffer createRingBuffer() {
return createRingBuffer(DEFAULT_RING_SIZE, DEFAULT_IOSEQ_ASYNC_THRESHOLD);
return createRingBuffer(DEFAULT_RING_SIZE, DEFAULT_IOSQE_ASYNC_THRESHOLD);
}

static void checkAllIOSupported(int ringFd) {
Expand Down

0 comments on commit c8b5294

Please sign in to comment.