Class ClientTpcConfig


  • @Beta
    public final class ClientTpcConfig
    extends java.lang.Object
    Contains client configurations for TPC.

    TPC is the next generation Hazelcast that uses thread-per-core model.

    TPC-aware clients will connect to the TPC ports depending on the configured number of connections.

    Since:
    5.3
    • Constructor Detail

      • ClientTpcConfig

        public ClientTpcConfig()
      • ClientTpcConfig

        public ClientTpcConfig​(@Nonnull
                               ClientTpcConfig tpcConfig)
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Returns if the TPC-aware mode is enabled.
        Returns:
        true if the TPC-aware mode is enabled, false otherwise.
        Since:
        5.3
      • setEnabled

        public ClientTpcConfig setEnabled​(boolean enabled)
        Enables or disables the TPC-aware mode.

        When enabled, the configuration option set by the ClientNetworkConfig.setSmartRouting(boolean) is ignored.

        Parameters:
        enabled - flag to enable or disable TPC-aware mode
        Returns:
        this configuration for chaining.
        Since:
        5.3
      • setConnectionCount

        public ClientTpcConfig setConnectionCount​(int connectionCount)
        Sets the number of connections to TPC ports offered by a Hazelcast member.
        1. If set to a negative value, an IllegalArgumentException will be thrown.
        2. If set to 0, the client will connect to every TPC port.
        3. If set to the same number as returned by the server, the client will connect to every TPC port.
        4. If set to a number larger than 0 and smaller than the number of returned TPC ports, the client will randomize the list of ports and make the configured number of connections.
        5. If set to a number larger than the number of TPC ports, the client will connect to each tpc port (has same effect as configuring 0)
        Increasing the number of connections leads to more packets with a smaller payload and this can lead to a performance penalty. Also in cloud environments e.g. AWS there can be a packets per second limit (pps) and it pretty easy to run into this limit if an equal number of connections is created as TPC ports on the server and a lot of small interactions are done e.g. a map.get with small payloads.
        Parameters:
        connectionCount - throws IllegalArgumentException when connectionCount is negative.
        Since:
        5.4
      • getConnectionCount

        public int getConnectionCount()
        Gets the connection count.
        Returns:
        the number of connections.
        Since:
        5.4
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object