[
https://issues.apache.org/jira/browse/IGNITE-26002?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vladislav Pyatkov updated IGNITE-26002:
---------------------------------------
Description:
h3. Motivation
Network threads are distributed by Netty's internal algorithm or by hash after
a handshake.
{code}
private static EventLoop eventLoopForKey(ChannelKey channelKey,
ChannelEventLoopsSource eventLoopsSource) {
List<EventLoop> eventLoops = eventLoopsSource.channelEventLoops();
int index = safeAbs(channelKey.hashCode()) % eventLoops.size();
return eventLoops.get(index);
}
{code}
They both ways are exposed to collision (choose the same threads for two
different nodes). In the case of a small amount of nodes, a collision leads to
a loading imbalance and throughput decreasing.
{noformat}
[consistentId=poc-tester-SERVER-172.25.4.33-id-0,
launchId=133e162c-5988-45cf-8266-944e67006af0, connectionId=1]: (index 49,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-50)
[consistentId=poc-tester-SERVER-172.25.4.97-id-0,
launchId=60ee5d7d-e5ec-4d44-abd7-fcb953682d9f, connectionId=1]: (index 49,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-50)
[consistentId=poc-tester-SERVER-172.25.4.33-id-0,
launchId=133e162c-5988-45cf-8266-944e67006af0, connectionId=0]: (index 48,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-49)
[consistentId=poc-tester-SERVER-172.25.4.97-id-0,
launchId=60ee5d7d-e5ec-4d44-abd7-fcb953682d9f, connectionId=0]: (index 48,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-49)
{noformat}
h3. Implementation notes
We can use a similar approach that is already used for choosing threads for
server-server communication. Any thread can handle a handshake, but the other
messages are handled in the chosen event loop.
The event loop chooser might store a state and choose the next event loop based
on knowledge of how many listeners are currently handling it.
h3. Definition of done
Threads are distributed evenly among all Netty message handlers.
was:
h3. Motivation
Network threads are distributed by Netty's internal algorithm or by hash after
a handshake.
{code}
private static EventLoop eventLoopForKey(ChannelKey channelKey,
ChannelEventLoopsSource eventLoopsSource) {
List<EventLoop> eventLoops = eventLoopsSource.channelEventLoops();
int index = safeAbs(channelKey.hashCode()) % eventLoops.size();
return eventLoops.get(index);
}
{code}
They both ways are exposed to collision (choose the same threads for two
different nodes). In the case of a small amount of nodes, a collision leads to
a loading imbalance and throughput decreasing.
{noformat}
[consistentId=poc-tester-SERVER-172.25.4.33-id-0,
launchId=133e162c-5988-45cf-8266-944e67006af0, connectionId=1]: (index 49,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-50)
[consistentId=poc-tester-SERVER-172.25.4.97-id-0,
launchId=60ee5d7d-e5ec-4d44-abd7-fcb953682d9f, connectionId=1]: (index 49,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-50)
[consistentId=poc-tester-SERVER-172.25.4.33-id-0,
launchId=133e162c-5988-45cf-8266-944e67006af0, connectionId=0]: (index 48,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-49)
[consistentId=poc-tester-SERVER-172.25.4.97-id-0,
launchId=60ee5d7d-e5ec-4d44-abd7-fcb953682d9f, connectionId=0]: (index 48,
thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-49)
{noformat}
h3. Definition of done
Threads are distributed evenly among all Netty message handlers.
> Network thread even distribution
> --------------------------------
>
> Key: IGNITE-26002
> URL: https://issues.apache.org/jira/browse/IGNITE-26002
> Project: Ignite
> Issue Type: Improvement
> Reporter: Vladislav Pyatkov
> Priority: Major
> Labels: ignite-3
>
> h3. Motivation
> Network threads are distributed by Netty's internal algorithm or by hash
> after a handshake.
> {code}
> private static EventLoop eventLoopForKey(ChannelKey channelKey,
> ChannelEventLoopsSource eventLoopsSource) {
> List<EventLoop> eventLoops = eventLoopsSource.channelEventLoops();
> int index = safeAbs(channelKey.hashCode()) % eventLoops.size();
> return eventLoops.get(index);
> }
> {code}
> They both ways are exposed to collision (choose the same threads for two
> different nodes). In the case of a small amount of nodes, a collision leads
> to a loading imbalance and throughput decreasing.
> {noformat}
> [consistentId=poc-tester-SERVER-172.25.4.33-id-0,
> launchId=133e162c-5988-45cf-8266-944e67006af0, connectionId=1]: (index 49,
> thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-50)
> [consistentId=poc-tester-SERVER-172.25.4.97-id-0,
> launchId=60ee5d7d-e5ec-4d44-abd7-fcb953682d9f, connectionId=1]: (index 49,
> thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-50)
> [consistentId=poc-tester-SERVER-172.25.4.33-id-0,
> launchId=133e162c-5988-45cf-8266-944e67006af0, connectionId=0]: (index 48,
> thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-49)
> [consistentId=poc-tester-SERVER-172.25.4.97-id-0,
> launchId=60ee5d7d-e5ec-4d44-abd7-fcb953682d9f, connectionId=0]: (index 48,
> thread poc-tester-SERVER-172.25.4.113-id-0-network-worker-49)
> {noformat}
> h3. Implementation notes
> We can use a similar approach that is already used for choosing threads for
> server-server communication. Any thread can handle a handshake, but the other
> messages are handled in the chosen event loop.
> The event loop chooser might store a state and choose the next event loop
> based on knowledge of how many listeners are currently handling it.
> h3. Definition of done
> Threads are distributed evenly among all Netty message handlers.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)