hazelcast / hazelcast-nodejs-client

Hazelcast Node.js Client
https://hazelcast.com/clients/node-js/
Apache License 2.0
150 stars 58 forks source link

[TRACKING ISSUE] TPC default to 1 connection #1513

Open hz-devops-test opened 9 months ago

hz-devops-test commented 9 months ago

The tracking issue for the Java side PR.

See https://github.com/hazelcast/hazelcast/pull/25871 for details.


Before this PR, when a TPC aware client connects to a TPC enabled server, the server sends the list of TPC ports it can connect to. So if the server has 64 TPC threads, it will open 64 server sockets and the client will make 64 connections.

The problem is that having many connections, leads to smaller and more packets which causes additional processing overhead and can run into packets per seconds limits (e.g. on AWS). And the performance penalty of the PPS limit is a lot higher than the penalty of context switching.

This PR changes that. By default, a client will now connect to 1 random port from the TPC port list. The Hazelcast member will then route the request to the right core (the same as with classic networking). The number of ports can be configured through the ClientTpcConfig object and one can restore the behavior of connecting to all TPC ports or a subset.