Skip to content
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

[#133] feat(netty): Add StreamServer. #718

Merged
merged 6 commits into from
Mar 15, 2023
Merged

Conversation

leixm
Copy link
Contributor

@leixm leixm commented Mar 14, 2023

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.

@jerqi jerqi changed the title [#133][Netty] Add StreamServer. [#133] feat(netty): Add StreamServer. Mar 14, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2023

Codecov Report

Merging #718 (1a4fea1) into master (e38d799) will increase coverage by 2.32%.
The diff coverage is 70.79%.

@@             Coverage Diff              @@
##             master     #718      +/-   ##
============================================
+ Coverage     60.60%   62.92%   +2.32%     
- Complexity     1849     1860      +11     
============================================
  Files           229      217      -12     
  Lines         12749    10898    -1851     
  Branches       1064     1073       +9     
============================================
- Hits           7727     6858     -869     
+ Misses         4611     3686     -925     
+ Partials        411      354      -57     
Impacted Files Coverage Δ
.../server/netty/decoder/StreamServerInitDecoder.java 0.00% <0.00%> (ø)
.../org/apache/uniffle/server/netty/StreamServer.java 62.50% <62.50%> (ø)
.../java/org/apache/uniffle/server/ShuffleServer.java 64.48% <71.42%> (+3.13%) ⬆️
...a/org/apache/uniffle/server/ShuffleServerConf.java 99.45% <100.00%> (+0.06%) ⬆️

... and 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok for me.

.defaultValue(false)
.withDescription("If enable netty server");

public static final ConfigOption<Boolean> SERVER_UPLOAD_EPOLL_ENABLE = ConfigOptions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the meaning of upload?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already Fixed.


private static final Logger logger = LoggerFactory.getLogger(StreamServerInitDecoder.class);

private ShuffleServer shuffleServer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need ShuffleServer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@jerqi
Copy link
Contributor

jerqi commented Mar 14, 2023

@smallzhongfeng Could you help me review this pr?

leixianming added 2 commits March 14, 2023 20:12
ch.pipeline().addLast(handlerSupplier.get());
}
})
.option(ChannelOption.SO_BACKLOG, backlogSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

channelFuture.channel().close().awaitUninterruptibly(10L, TimeUnit.SECONDS);
channelFuture = null;
}
shuffleBossGroup.shutdownGracefully();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShuffleBossGroup determines whether it is empty ?


addDecoder(ctx, magicByte);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this blank line.

@leixm
Copy link
Contributor Author

leixm commented Mar 14, 2023

@smallzhongfeng All done.

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe >= 0?

@jerqi could you also add port=0 for random port binding?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We set up an issue first.

.key("rss.server.netty.epoll.enable")
.booleanType()
.defaultValue(false)
.withDescription("If enable epoll model with netty server");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

public static final ConfigOption<Integer> NETTY_SERVER_CONNECT_BACKLOG = ConfigOptions
.key("rss.server.netty.connect.backlog")
.intType()
.defaultValue(1000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is 1000 enough?

.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");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some desc about what the default value -1 means?

.key("rss.server.netty.receive.buf")
.intType()
.defaultValue(-1)
.withDescription("the optimal size for receive buffer(SO_RCVBUF) "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Comment on lines 76 to 79
ServerBootstrap serverBootstrap = bossGroup instanceof EpollEventLoopGroup
? new ServerBootstrap().group(bossGroup, workerGroup)
.channel(EpollServerSocketChannel.class)
: new ServerBootstrap().group(bossGroup, workerGroup)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the indentation looks a bit weird..

Copy link
Contributor

@smallzhongfeng smallzhongfeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leixm
Copy link
Contributor Author

leixm commented Mar 15, 2023

@advancedxy All done.

@leixm
Copy link
Contributor Author

leixm commented Mar 15, 2023

@jerqi @advancedxy Can you help review plz?

Copy link
Contributor

@jerqi jerqi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @advancedxy @leixm @smallzhongfeng merged.

@jerqi jerqi merged commit 46f3f7e into apache:master Mar 15, 2023
advancedxy pushed a commit to advancedxy/incubator-uniffle that referenced this pull request Mar 21, 2023
### 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.

Co-authored-by: leixianming <leixianming@didiglobal.com>
xianjingfeng pushed a commit to xianjingfeng/incubator-uniffle that referenced this pull request Apr 5, 2023
### 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.

Co-authored-by: leixianming <leixianming@didiglobal.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants