Skip to content

Commit

Permalink
remove system property value set numDirectArenas
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Maurya <[email protected]>
  • Loading branch information
rishabhmaurya committed Feb 20, 2025
1 parent 0ff82f7 commit c377e98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
2 changes: 2 additions & 0 deletions plugins/arrow-flight-rpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ tasks.named('test').configure {
}

test {
systemProperty 'io.netty.allocator.numDirectArenas', '1'
systemProperty 'io.netty.noUnsafe', 'false'
systemProperty 'io.netty.tryUnsafe', 'true'
systemProperty 'io.netty.tryReflectionSetAccessible', 'true'
}

internalClusterTest {
systemProperty 'io.netty.allocator.numDirectArenas', '1'
systemProperty 'io.netty.noUnsafe', 'false'
systemProperty 'io.netty.tryUnsafe', 'true'
systemProperty 'io.netty.tryReflectionSetAccessible', 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.OpenSearchExecutors;
import org.opensearch.threadpool.ScalingExecutorBuilder;

import java.security.AccessController;
Expand All @@ -29,7 +30,6 @@
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.util.concurrent.DefaultThreadFactory;

/**
* Configuration class for OpenSearch Flight server settings.
Expand Down Expand Up @@ -172,18 +172,14 @@ public static List<Setting<?>> getSettings() {
ARROW_ENABLE_UNSAFE_MEMORY_ACCESS,
ARROW_SSL_ENABLE
)
) {
{
addAll(Netty4Configs.getSettings());
}
};
);
}

static EventLoopGroup createELG(String name, int eventLoopThreads) {

return Epoll.isAvailable()
? new EpollEventLoopGroup(eventLoopThreads, new DefaultThreadFactory(name, true))
: new NioEventLoopGroup(eventLoopThreads, new DefaultThreadFactory(name, true));
? new EpollEventLoopGroup(eventLoopThreads, OpenSearchExecutors.daemonThreadFactory(name))
: new NioEventLoopGroup(eventLoopThreads, OpenSearchExecutors.daemonThreadFactory(name));
}

static Class<? extends Channel> serverChannelType() {
Expand All @@ -195,16 +191,10 @@ static Class<? extends Channel> clientChannelType() {
}

private static class Netty4Configs {
public static final Setting<Integer> NETTY_ALLOCATOR_NUM_DIRECT_ARENAS = Setting.intSetting(
"io.netty.allocator.numDirectArenas",
1, // TODO - 2 * the number of available processors; to be confirmed and set after running benchmarks
1,
Setting.Property.NodeScope
);

@SuppressForbidden(reason = "required for netty allocator configuration")
public static void init(Settings settings) {
System.setProperty("io.netty.allocator.numDirectArenas", Integer.toString(NETTY_ALLOCATOR_NUM_DIRECT_ARENAS.get(settings)));
checkSystemProperty("io.netty.allocator.numDirectArenas", "1");
checkSystemProperty("io.netty.noUnsafe", "false");
checkSystemProperty("io.netty.tryUnsafe", "true");
checkSystemProperty("io.netty.tryReflectionSetAccessible", "true");
Expand All @@ -224,9 +214,5 @@ private static void checkSystemProperty(String propertyName, String expectedValu
);
}
}

public static List<Setting<?>> getSettings() {
return List.of(NETTY_ALLOCATOR_NUM_DIRECT_ARENAS);
}
}
}

0 comments on commit c377e98

Please sign in to comment.