You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "leixm (via GitHub)" <gi...@apache.org> on 2023/03/14 11:48:52 UTC

[GitHub] [incubator-uniffle] leixm opened a new pull request, #718: [#133][Netty] Add StreamServer.

leixm opened a new pull request, #718:
URL: https://github.com/apache/incubator-uniffle/pull/718

   ### What changes were proposed in this pull request?
   
   Add StreamServer for netty replace grpc.
   
   ### Why are the changes needed?
   Add StreamServer.
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   
   UT.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] smallzhongfeng commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "smallzhongfeng (via GitHub)" <gi...@apache.org>.
smallzhongfeng commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135472436


##########
server/src/main/java/org/apache/uniffle/server/netty/StreamServer.java:
##########
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty;
+
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.epoll.EpollEventLoopGroup;
+import io.netty.channel.epoll.EpollServerSocketChannel;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.common.util.ExitUtils;
+import org.apache.uniffle.server.ShuffleServer;
+import org.apache.uniffle.server.ShuffleServerConf;
+import org.apache.uniffle.server.netty.decoder.StreamServerInitDecoder;
+
+public class StreamServer {
+
+  private static final Logger LOG = LoggerFactory.getLogger(StreamServer.class);
+
+  private ShuffleServer shuffleServer;
+  private EventLoopGroup shuffleBossGroup;
+  private EventLoopGroup shuffleWorkerGroup;
+  private ShuffleServerConf shuffleServerConf;
+  private ChannelFuture channelFuture;
+
+  public StreamServer(ShuffleServer shuffleServer) {
+    this.shuffleServer = shuffleServer;
+    this.shuffleServerConf = shuffleServer.getShuffleServerConf();
+    boolean isEpollEnable = shuffleServerConf.getBoolean(ShuffleServerConf.NETTY_SERVER_EPOLL_ENABLE);
+    int acceptThreads = shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_ACCEPT_THREAD);
+    int workerThreads = shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_WORKER_THREAD);
+    if (isEpollEnable) {
+      shuffleBossGroup = new EpollEventLoopGroup(acceptThreads);
+      shuffleWorkerGroup = new EpollEventLoopGroup(workerThreads);
+    } else {
+      shuffleBossGroup = new NioEventLoopGroup(acceptThreads);
+      shuffleWorkerGroup = new NioEventLoopGroup(workerThreads);
+    }
+  }
+
+  private ServerBootstrap bootstrapChannel(
+      EventLoopGroup bossGroup,
+      EventLoopGroup workerGroup,
+      int backlogSize,
+      int timeoutMillis,
+      Supplier<ChannelHandler[]> handlerSupplier) {
+    ServerBootstrap serverBootstrap = bossGroup instanceof EpollEventLoopGroup
+                                          ? new ServerBootstrap().group(bossGroup, workerGroup)
+                                                .channel(EpollServerSocketChannel.class)
+                                          : new ServerBootstrap().group(bossGroup, workerGroup)
+                                                .channel(NioServerSocketChannel.class);
+
+    return serverBootstrap.childHandler(new ChannelInitializer<SocketChannel>() {
+      @Override
+      public void initChannel(final SocketChannel ch) {
+        ch.pipeline().addLast(handlerSupplier.get());
+      }
+    })
+               .option(ChannelOption.SO_BACKLOG, backlogSize)

Review Comment:
   Maybe we should add Option `TCP_NODELAY`, this parameter should be used to send packets this time. It does not need to use Nagle algorithm to reduce the delay time.



##########
server/src/main/java/org/apache/uniffle/server/netty/StreamServer.java:
##########
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty;
+
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.epoll.EpollEventLoopGroup;
+import io.netty.channel.epoll.EpollServerSocketChannel;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.common.util.ExitUtils;
+import org.apache.uniffle.server.ShuffleServer;
+import org.apache.uniffle.server.ShuffleServerConf;
+import org.apache.uniffle.server.netty.decoder.StreamServerInitDecoder;
+
+public class StreamServer {
+
+  private static final Logger LOG = LoggerFactory.getLogger(StreamServer.class);
+
+  private ShuffleServer shuffleServer;
+  private EventLoopGroup shuffleBossGroup;
+  private EventLoopGroup shuffleWorkerGroup;
+  private ShuffleServerConf shuffleServerConf;
+  private ChannelFuture channelFuture;
+
+  public StreamServer(ShuffleServer shuffleServer) {
+    this.shuffleServer = shuffleServer;
+    this.shuffleServerConf = shuffleServer.getShuffleServerConf();
+    boolean isEpollEnable = shuffleServerConf.getBoolean(ShuffleServerConf.NETTY_SERVER_EPOLL_ENABLE);
+    int acceptThreads = shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_ACCEPT_THREAD);
+    int workerThreads = shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_WORKER_THREAD);
+    if (isEpollEnable) {
+      shuffleBossGroup = new EpollEventLoopGroup(acceptThreads);
+      shuffleWorkerGroup = new EpollEventLoopGroup(workerThreads);
+    } else {
+      shuffleBossGroup = new NioEventLoopGroup(acceptThreads);
+      shuffleWorkerGroup = new NioEventLoopGroup(workerThreads);
+    }
+  }
+
+  private ServerBootstrap bootstrapChannel(
+      EventLoopGroup bossGroup,
+      EventLoopGroup workerGroup,
+      int backlogSize,
+      int timeoutMillis,
+      Supplier<ChannelHandler[]> handlerSupplier) {
+    ServerBootstrap serverBootstrap = bossGroup instanceof EpollEventLoopGroup
+                                          ? new ServerBootstrap().group(bossGroup, workerGroup)
+                                                .channel(EpollServerSocketChannel.class)
+                                          : new ServerBootstrap().group(bossGroup, workerGroup)
+                                                .channel(NioServerSocketChannel.class);
+
+    return serverBootstrap.childHandler(new ChannelInitializer<SocketChannel>() {
+      @Override
+      public void initChannel(final SocketChannel ch) {
+        ch.pipeline().addLast(handlerSupplier.get());
+      }
+    })
+               .option(ChannelOption.SO_BACKLOG, backlogSize)
+               .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, timeoutMillis)
+               .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
+               .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, timeoutMillis)
+               .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
+  }
+
+  public void start() {
+    Supplier<ChannelHandler[]> streamHandlers = () -> new ChannelHandler[]{
+        new StreamServerInitDecoder()
+    };
+    ServerBootstrap serverBootstrap = bootstrapChannel(shuffleBossGroup, shuffleWorkerGroup,
+        shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_CONNECT_BACKLOG),
+        shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_CONNECT_TIMEOUT), streamHandlers);
+
+    // Bind the ports and save the results so that the channels can be closed later.
+    // If the second bind fails, the first one gets cleaned up in the shutdown.
+    int port = shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_PORT);
+    try {
+      channelFuture =  serverBootstrap.bind(port);
+      channelFuture.syncUninterruptibly();
+      LOG.info("bind localAddress is " + channelFuture.channel().localAddress());
+      LOG.info("Start stream server successfully with port " + port);
+    } catch (Exception e) {
+      ExitUtils.terminate(1, "Fail to start stream server", e, LOG);
+    }
+  }
+
+  public void stop() {
+    if (channelFuture != null) {
+      channelFuture.channel().close().awaitUninterruptibly(10L, TimeUnit.SECONDS);
+      channelFuture = null;
+    }
+    shuffleBossGroup.shutdownGracefully();

Review Comment:
   `ShuffleBossGroup` determines whether it is empty ?



##########
server/src/main/java/org/apache/uniffle/server/netty/decoder/StreamServerInitDecoder.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty.decoder;
+
+import java.util.List;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+
+public class StreamServerInitDecoder extends ByteToMessageDecoder {
+
+  public StreamServerInitDecoder() {
+  }
+
+  private void addDecoder(ChannelHandlerContext ctx, byte type) {
+
+  }
+
+  @Override
+  protected void decode(ChannelHandlerContext ctx,
+      ByteBuf in,
+      List<Object> out) {
+    if (in.readableBytes() < Byte.BYTES) {
+      return;
+    }
+    in.markReaderIndex();
+    byte magicByte = in.readByte();
+    in.resetReaderIndex();
+
+    addDecoder(ctx, magicByte);
+  }
+

Review Comment:
   Remove this blank line.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#issuecomment-1469209937

   @jerqi  @advancedxy  Can you help review plz?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135471641


##########
server/src/main/java/org/apache/uniffle/server/netty/decoder/StreamServerInitDecoder.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty.decoder;
+
+import java.util.List;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.server.ShuffleServer;
+
+public class StreamServerInitDecoder extends ByteToMessageDecoder {
+
+  private static final Logger logger = LoggerFactory.getLogger(StreamServerInitDecoder.class);
+
+  private ShuffleServer shuffleServer;

Review Comment:
   In fact, StreamServerInitDecoder needs ShuffleServer to obtain taskManager, etc. I will delete it in this PR, and add it to subsequent PRs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1136606260


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");

Review Comment:
   > It is difficult to give a suggestion at present, so the default value is nio.
   
   That's OK. Let's add a todo in the final PR, which I think will includes a comprehensive docs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135470227


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,48 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_ENABLED = ConfigOptions

Review Comment:
   It's ok for me.



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,48 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_ENABLED = ConfigOptions
+      .key("rss.server.netty.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable netty server");
+
+  public static final ConfigOption<Boolean> SERVER_UPLOAD_EPOLL_ENABLE = ConfigOptions

Review Comment:
   Already Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135642644


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");

Review Comment:
   We set up an issue first.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "advancedxy (via GitHub)" <gi...@apache.org>.
advancedxy commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135574599


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServer.java:
##########
@@ -221,6 +230,10 @@ private void initialization() throws Exception {
     shuffleBufferManager = new ShuffleBufferManager(shuffleServerConf, shuffleFlushManager);
     shuffleTaskManager = new ShuffleTaskManager(shuffleServerConf, shuffleFlushManager,
         shuffleBufferManager, storageManager);
+    nettyServerEnabled = shuffleServerConf.get(ShuffleServerConf.NETTY_SERVER_PORT) > 0;

Review Comment:
   Maybe >= 0?
   
   @jerqi could you also add port=0 for random port binding?



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_ACCEPT_THREAD = ConfigOptions
+      .key("rss.server.netty.accept.thread")
+      .intType()
+      .defaultValue(10)
+      .withDescription("Accept thread count in netty");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_WORKER_THREAD = ConfigOptions
+      .key("rss.server.netty.worker.thread")
+      .intType()
+      .defaultValue(100)
+      .withDescription("Worker thread count in netty");
+
+  public static final ConfigOption<Long> SERVER_NETTY_HANDLER_IDLE_TIMEOUT = ConfigOptions
+      .key("rss.server.netty.handler.idle.timeout")
+      .longType()
+      .defaultValue(60000L)
+      .withDescription("Idle timeout if there has not data");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_CONNECT_BACKLOG = ConfigOptions
+      .key("rss.server.netty.connect.backlog")
+      .intType()
+      .defaultValue(1000)

Review Comment:
   is 1000 enough?



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");

Review Comment:
   nit: whether to enable epoll mode with netty server? 
   
   Also, could you add more description about how epoll mode diffs with normal mode?
   
   You can update the docs in the final PR?



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_ACCEPT_THREAD = ConfigOptions
+      .key("rss.server.netty.accept.thread")
+      .intType()
+      .defaultValue(10)
+      .withDescription("Accept thread count in netty");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_WORKER_THREAD = ConfigOptions
+      .key("rss.server.netty.worker.thread")
+      .intType()
+      .defaultValue(100)
+      .withDescription("Worker thread count in netty");
+
+  public static final ConfigOption<Long> SERVER_NETTY_HANDLER_IDLE_TIMEOUT = ConfigOptions
+      .key("rss.server.netty.handler.idle.timeout")
+      .longType()
+      .defaultValue(60000L)
+      .withDescription("Idle timeout if there has not data");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_CONNECT_BACKLOG = ConfigOptions
+      .key("rss.server.netty.connect.backlog")
+      .intType()
+      .defaultValue(1000)
+      .withDescription("Backlog for connection in netty");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_CONNECT_TIMEOUT = ConfigOptions
+      .key("rss.server.netty.connect.timeout")
+      .intType()
+      .defaultValue(5000)
+      .withDescription("Timeout for connection in netty");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_SEND_BUF = ConfigOptions
+      .key("rss.server.netty.send.buf")
+      .intType()
+      .defaultValue(-1)
+      .withDescription("the optimal size for send buffer(SO_SNDBUF) "
+                           + "should be latency * network_bandwidth. Assuming latency = 1ms,"
+                           + "network_bandwidth = 10Gbps, buffer size should be ~ 1.25MB");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_RECEIVE_BUF = ConfigOptions
+      .key("rss.server.netty.receive.buf")
+      .intType()
+      .defaultValue(-1)
+      .withDescription("the optimal size for receive buffer(SO_RCVBUF) "

Review Comment:
   ditto.



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_ACCEPT_THREAD = ConfigOptions
+      .key("rss.server.netty.accept.thread")
+      .intType()
+      .defaultValue(10)
+      .withDescription("Accept thread count in netty");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_WORKER_THREAD = ConfigOptions
+      .key("rss.server.netty.worker.thread")
+      .intType()
+      .defaultValue(100)
+      .withDescription("Worker thread count in netty");
+
+  public static final ConfigOption<Long> SERVER_NETTY_HANDLER_IDLE_TIMEOUT = ConfigOptions
+      .key("rss.server.netty.handler.idle.timeout")
+      .longType()
+      .defaultValue(60000L)
+      .withDescription("Idle timeout if there has not data");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_CONNECT_BACKLOG = ConfigOptions
+      .key("rss.server.netty.connect.backlog")
+      .intType()
+      .defaultValue(1000)
+      .withDescription("Backlog for connection in netty");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_CONNECT_TIMEOUT = ConfigOptions
+      .key("rss.server.netty.connect.timeout")
+      .intType()
+      .defaultValue(5000)
+      .withDescription("Timeout for connection in netty");
+
+  public static final ConfigOption<Integer> NETTY_SERVER_SEND_BUF = ConfigOptions
+      .key("rss.server.netty.send.buf")
+      .intType()
+      .defaultValue(-1)
+      .withDescription("the optimal size for send buffer(SO_SNDBUF) "
+                           + "should be latency * network_bandwidth. Assuming latency = 1ms,"
+                           + "network_bandwidth = 10Gbps, buffer size should be ~ 1.25MB");

Review Comment:
   Add some desc about what the default value `-1` means?



##########
server/src/main/java/org/apache/uniffle/server/netty/StreamServer.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty;
+
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.epoll.EpollEventLoopGroup;
+import io.netty.channel.epoll.EpollServerSocketChannel;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.common.util.ExitUtils;
+import org.apache.uniffle.server.ShuffleServer;
+import org.apache.uniffle.server.ShuffleServerConf;
+import org.apache.uniffle.server.netty.decoder.StreamServerInitDecoder;
+
+public class StreamServer {
+
+  private static final Logger LOG = LoggerFactory.getLogger(StreamServer.class);
+
+  private ShuffleServer shuffleServer;
+  private EventLoopGroup shuffleBossGroup;
+  private EventLoopGroup shuffleWorkerGroup;
+  private ShuffleServerConf shuffleServerConf;
+  private ChannelFuture channelFuture;
+
+  public StreamServer(ShuffleServer shuffleServer) {
+    this.shuffleServer = shuffleServer;
+    this.shuffleServerConf = shuffleServer.getShuffleServerConf();
+    boolean isEpollEnable = shuffleServerConf.getBoolean(ShuffleServerConf.NETTY_SERVER_EPOLL_ENABLE);
+    int acceptThreads = shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_ACCEPT_THREAD);
+    int workerThreads = shuffleServerConf.getInteger(ShuffleServerConf.NETTY_SERVER_WORKER_THREAD);
+    if (isEpollEnable) {
+      shuffleBossGroup = new EpollEventLoopGroup(acceptThreads);
+      shuffleWorkerGroup = new EpollEventLoopGroup(workerThreads);
+    } else {
+      shuffleBossGroup = new NioEventLoopGroup(acceptThreads);
+      shuffleWorkerGroup = new NioEventLoopGroup(workerThreads);
+    }
+  }
+
+  private ServerBootstrap bootstrapChannel(
+      EventLoopGroup bossGroup,
+      EventLoopGroup workerGroup,
+      int backlogSize,
+      int timeoutMillis,
+      int sendBuf,
+      int receiveBuf,
+      Supplier<ChannelHandler[]> handlerSupplier) {
+    ServerBootstrap serverBootstrap = bossGroup instanceof EpollEventLoopGroup
+                                          ? new ServerBootstrap().group(bossGroup, workerGroup)
+                                                .channel(EpollServerSocketChannel.class)
+                                          : new ServerBootstrap().group(bossGroup, workerGroup)

Review Comment:
   nit: the indentation looks a bit weird..



##########
server/src/main/java/org/apache/uniffle/server/netty/StreamServer.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty;
+
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.epoll.EpollEventLoopGroup;
+import io.netty.channel.epoll.EpollServerSocketChannel;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.common.util.ExitUtils;
+import org.apache.uniffle.server.ShuffleServer;
+import org.apache.uniffle.server.ShuffleServerConf;
+import org.apache.uniffle.server.netty.decoder.StreamServerInitDecoder;
+
+public class StreamServer {
+
+  private static final Logger LOG = LoggerFactory.getLogger(StreamServer.class);
+
+  private ShuffleServer shuffleServer;
+  private EventLoopGroup shuffleBossGroup;
+  private EventLoopGroup shuffleWorkerGroup;
+  private ShuffleServerConf shuffleServerConf;
+  private ChannelFuture channelFuture;
+
+  public StreamServer(ShuffleServer shuffleServer) {

Review Comment:
   The UTs of this class would be added in later PRs?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135648568


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");

Review Comment:
   EPOLL is more suitable for scenarios with a large number of connections, but we need more tests to verify the difference between nio and epoll in uniffle usage scenarios. It is difficult to give a suggestion at present, so the default value is nio.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi commented on pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#issuecomment-1467968447

   @smallzhongfeng Could you help me review this pr?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#issuecomment-1468126031

   @smallzhongfeng  All done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#issuecomment-1468125462

    cc@smallzhongfeng  All done. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] codecov-commenter commented on pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#issuecomment-1467966855

   ## [Codecov](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#718](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1cb3cdd) into [master](https://codecov.io/gh/apache/incubator-uniffle/commit/e38d79952732483756249859aa3a7061233644e1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (e38d799) will **increase** coverage by `2.33%`.
   > The diff coverage is `73.83%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master     #718      +/-   ##
   ============================================
   + Coverage     60.60%   62.94%   +2.33%     
   - Complexity     1849     1858       +9     
   ============================================
     Files           229      218      -11     
     Lines         12749    10892    -1857     
     Branches       1064     1068       +4     
   ============================================
   - Hits           7727     6856     -871     
   + Misses         4611     3683     -928     
   + Partials        411      353      -58     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../server/netty/decoder/StreamServerInitDecoder.java](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL3NlcnZlci9uZXR0eS9kZWNvZGVyL1N0cmVhbVNlcnZlckluaXREZWNvZGVyLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...g/apache/uniffle/server/netty/util/NettyUtils.java](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL3NlcnZlci9uZXR0eS91dGlsL05ldHR5VXRpbHMuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [.../org/apache/uniffle/server/netty/StreamServer.java](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL3NlcnZlci9uZXR0eS9TdHJlYW1TZXJ2ZXIuamF2YQ==) | `80.85% <80.85%> (ø)` | |
   | [.../java/org/apache/uniffle/server/ShuffleServer.java](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL3NlcnZlci9TaHVmZmxlU2VydmVyLmphdmE=) | `64.48% <85.71%> (+3.13%)` | :arrow_up: |
   | [...a/org/apache/uniffle/server/ShuffleServerConf.java](https://codecov.io/gh/apache/incubator-uniffle/pull/718?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL3NlcnZlci9TaHVmZmxlU2VydmVyQ29uZi5qYXZh) | `99.45% <100.00%> (+0.05%)` | :arrow_up: |
   
   ... and [14 files with indirect coverage changes](https://codecov.io/gh/apache/incubator-uniffle/pull/718/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135431235


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,48 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_ENABLED = ConfigOptions

Review Comment:
   We don't need this config option. If netty port is set, we should enable Netty server.



##########
server/src/main/java/org/apache/uniffle/server/netty/decoder/StreamServerInitDecoder.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty.decoder;
+
+import java.util.List;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.server.ShuffleServer;
+
+public class StreamServerInitDecoder extends ByteToMessageDecoder {
+
+  private static final Logger logger = LoggerFactory.getLogger(StreamServerInitDecoder.class);
+
+  private ShuffleServer shuffleServer;

Review Comment:
   Why do we need `ShuffleServer`?



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,48 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_ENABLED = ConfigOptions
+      .key("rss.server.netty.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable netty server");
+
+  public static final ConfigOption<Boolean> SERVER_UPLOAD_EPOLL_ENABLE = ConfigOptions

Review Comment:
   What's the meaning of `upload`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1136469938


##########
server/src/main/java/org/apache/uniffle/server/netty/StreamServer.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server.netty;
+
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.buffer.PooledByteBufAllocator;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.epoll.EpollEventLoopGroup;
+import io.netty.channel.epoll.EpollServerSocketChannel;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.uniffle.common.util.ExitUtils;
+import org.apache.uniffle.server.ShuffleServer;
+import org.apache.uniffle.server.ShuffleServerConf;
+import org.apache.uniffle.server.netty.decoder.StreamServerInitDecoder;
+
+public class StreamServer {
+
+  private static final Logger LOG = LoggerFactory.getLogger(StreamServer.class);
+
+  private ShuffleServer shuffleServer;
+  private EventLoopGroup shuffleBossGroup;
+  private EventLoopGroup shuffleWorkerGroup;
+  private ShuffleServerConf shuffleServerConf;
+  private ChannelFuture channelFuture;
+
+  public StreamServer(ShuffleServer shuffleServer) {

Review Comment:
   sure. I will add in later PRs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135642644


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -404,6 +404,58 @@ public class ShuffleServerConf extends RssBaseConf {
       .defaultValue(-1)
       .withDescription("Shuffle netty server port");
 
+  public static final ConfigOption<Boolean> NETTY_SERVER_EPOLL_ENABLE = ConfigOptions
+      .key("rss.server.netty.epoll.enable")
+      .booleanType()
+      .defaultValue(false)
+      .withDescription("If enable epoll model with netty server");

Review Comment:
   We set up an issue first.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#discussion_r1135700209


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServer.java:
##########
@@ -221,6 +230,10 @@ private void initialization() throws Exception {
     shuffleBufferManager = new ShuffleBufferManager(shuffleServerConf, shuffleFlushManager);
     shuffleTaskManager = new ShuffleTaskManager(shuffleServerConf, shuffleFlushManager,
         shuffleBufferManager, storageManager);
+    nettyServerEnabled = shuffleServerConf.get(ShuffleServerConf.NETTY_SERVER_PORT) > 0;

Review Comment:
   We set up an issue first.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] leixm commented on pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "leixm (via GitHub)" <gi...@apache.org>.
leixm commented on PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718#issuecomment-1469209590

   @advancedxy  All done.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi merged pull request #718: [#133] feat(netty): Add StreamServer.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi merged PR #718:
URL: https://github.com/apache/incubator-uniffle/pull/718


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org