Class TcpCommunicationSpi
TcpCommunicationSpi is default communication SPI which uses TCP/IP protocol and Java NIO to communicate with other nodes.
At startup, this SPI tries to start listening to local port specified by LocalPort property. If local port is occupied, then SPI will automatically increment the port number until it can successfully bind for listening. LocalPortRange configuration parameter controls maximum number of ports that SPI will try before it fails. Port range comes very handy when starting multiple grid nodes on the same machine or even in the same VM. In this case all nodes can be brought up without a single change in configuration.
Inheritance
Implements
Inherited Members
Namespace: Apache.Ignite.Core.Communication.Tcp
Assembly: Apache.Ignite.Core.dll
Syntax
public class TcpCommunicationSpi : ICommunicationSpi
Constructors
TcpCommunicationSpi()
Initializes a new instance of the TcpCommunicationSpi class.
Declaration
public TcpCommunicationSpi()
Fields
DefaultAckSendThreshold
Default value of AckSendThreshold property.
Declaration
public const int DefaultAckSendThreshold = 16
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultConnectTimeout
Default value of ConnectTimeout property.
Declaration
public static readonly TimeSpan DefaultConnectTimeout
Field Value
| Type | Description |
|---|---|
| System.TimeSpan |
DefaultDirectBuffer
Default value of DirectBuffer property.
Declaration
public const bool DefaultDirectBuffer = true
Field Value
| Type | Description |
|---|---|
| System.Boolean |
DefaultDirectSendBuffer
Default value of DirectSendBuffer property.
Declaration
public const bool DefaultDirectSendBuffer = false
Field Value
| Type | Description |
|---|---|
| System.Boolean |
DefaultIdleConnectionTimeout
Default value of IdleConnectionTimeout property.
Declaration
public static readonly TimeSpan DefaultIdleConnectionTimeout
Field Value
| Type | Description |
|---|---|
| System.TimeSpan |
DefaultLocalPort
Default value of LocalPort property.
Declaration
public const int DefaultLocalPort = 47100
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultLocalPortRange
Default value of LocalPortRange property.
Declaration
public const int DefaultLocalPortRange = 100
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultMaxConnectTimeout
Default value of MaxConnectTimeout property.
Declaration
public static readonly TimeSpan DefaultMaxConnectTimeout
Field Value
| Type | Description |
|---|---|
| System.TimeSpan |
DefaultMessageQueueLimit
Default value of MessageQueueLimit property.
Declaration
public const int DefaultMessageQueueLimit = 1024
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultReconnectCount
Default value of ReconnectCount property.
Declaration
public const int DefaultReconnectCount = 10
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultSelectorsCount
Default value of SelectorsCount property.
Declaration
public static readonly int DefaultSelectorsCount
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultSocketBufferSize
Default socket buffer size.
Declaration
public const int DefaultSocketBufferSize = 32768
Field Value
| Type | Description |
|---|---|
| System.Int32 |
DefaultTcpNoDelay
Default value of TcpNoDelay property.
Declaration
public const bool DefaultTcpNoDelay = true
Field Value
| Type | Description |
|---|---|
| System.Boolean |
Properties
AckSendThreshold
Gets or sets the number of received messages per connection to node after which acknowledgment message is sent.
Declaration
public int AckSendThreshold { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ConnectTimeout
Gets or sets the connect timeout used when establishing connection with remote nodes.
Declaration
public TimeSpan ConnectTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| System.TimeSpan |
DirectBuffer
Gets or sets a value indicating whether to allocate direct (ByteBuffer.allocateDirect) or heap (ByteBuffer.allocate) buffer.
Declaration
public bool DirectBuffer { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DirectSendBuffer
Gets or sets a value indicating whether to allocate direct (ByteBuffer.allocateDirect) or heap (ByteBuffer.allocate) send buffer.
Declaration
public bool DirectSendBuffer { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IdleConnectionTimeout
Sets maximum idle connection timeout upon which a connection to client will be closed.
Declaration
public TimeSpan IdleConnectionTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| System.TimeSpan |
LocalAddress
Gets or sets the local host address for socket binding. Note that one node could have additional addresses beside the loopback one. This configuration parameter is optional.
Declaration
public string LocalAddress { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
LocalPort
Gets or sets the local port for socket binding.
Declaration
public int LocalPort { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
LocalPortRange
Gets or sets local port range for local host ports (value must greater than or equal to 0). If provided local port LocalPort is occupied, implementation will try to increment the port number for as long as it is less than initial value plus this range.
If port range value is 0, then implementation will try bind only to the port provided by
LocalPort method and fail if binding to this port did not succeed.
Declaration
public int LocalPortRange { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MaxConnectTimeout
Gets or sets maximum connect timeout. If handshake is not established within connect timeout, then SPI tries to repeat handshake procedure with increased connect timeout. Connect timeout can grow till maximum timeout value, if maximum timeout value is reached then the handshake is considered as failed.
0 is interpreted as infinite timeout.
Declaration
public TimeSpan MaxConnectTimeout { get; set; }
Property Value
| Type | Description |
|---|---|
| System.TimeSpan |
MessageQueueLimit
Gets or sets the message queue limit for incoming and outgoing messages.
When set to positive number send queue is limited to the configured value.
0 disables the limitation.
Declaration
public int MessageQueueLimit { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ReconnectCount
Gets or sets the maximum number of reconnect attempts used when establishing connection with remote nodes.
Declaration
public int ReconnectCount { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
SelectorsCount
Gets or sets the count of selectors te be used in TCP server.
Default value is DefaultSelectorsCount, which is calculated as
Math.Min(4, Environment.ProcessorCount)
Declaration
public int SelectorsCount { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
SlowClientQueueLimit
Gets or sets slow client queue limit.
When set to a positive number, communication SPI will monitor clients outbound message queue sizes and will drop those clients whose queue exceeded this limit.
Usually this value should be set to the same value as MessageQueueLimit which controls
message back-pressure for server nodes. The default value for this parameter is 0
which means unlimited.
Declaration
public int SlowClientQueueLimit { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
SocketReceiveBufferSize
Gets or sets the size of the socket receive buffer.
Declaration
public int SocketReceiveBufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
SocketSendBufferSize
Gets or sets the size of the socket send buffer.
Declaration
public int SocketSendBufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
TcpNoDelay
Gets or sets the value for TCP_NODELAY socket option. Each
socket will be opened using provided value.
Setting this option to true disables Nagle's algorithm
for socket decreasing latency and delivery time for small messages.
For systems that work under heavy network load it is advisable to set this value to false.
Declaration
public bool TcpNoDelay { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
UnacknowledgedMessagesBufferSize
Gets or sets the maximum number of stored unacknowledged messages per connection to node. If number of unacknowledged messages exceeds this number then connection to node is closed and reconnect is attempted.
Declaration
public int UnacknowledgedMessagesBufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |