Skip to content

Change native library default to epoll over io_uring #3278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Move the warning log to isAvailable method
  • Loading branch information
thachlp committed May 19, 2025
commit 3e221a13d98d79c44d18f38aee28070e81f24455
13 changes: 5 additions & 8 deletions src/main/java/io/lettuce/core/resource/Transports.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,18 @@ public static Class<? extends DatagramChannel> datagramChannelClass() {
*/
public static class NativeTransports {

private static final InternalLogger epollLogger = InternalLoggerFactory.getInstance(EpollProvider.class);
private static final InternalLogger transportsLogger = InternalLoggerFactory.getInstance(Transports.class);

static EventLoopResources RESOURCES = KqueueProvider.isAvailable() ? KqueueProvider.getResources()
: EpollProvider.isAvailable() ? EpollProvider.getResources() : IOUringProvider.getResources();

static {
if (EpollProvider.isAvailable() && IOUringProvider.isAvailable()) {
epollLogger.warn("Both epoll and io_uring native transports are available, epoll has been prioritized.");
}
}
: IOUringProvider.isAvailable() ? IOUringProvider.getResources() : EpollProvider.getResources();

/**
* @return {@code true} if a native transport is available.
*/
static boolean isAvailable() {
if (EpollProvider.isAvailable() && IOUringProvider.isAvailable()) {
transportsLogger.warn("Both epoll and io_uring native transports are available, epoll has been prioritized.");
}
return EpollProvider.isAvailable() || KqueueProvider.isAvailable() || IOUringProvider.isAvailable();
}

Expand Down