Search Results for

Show / Hide Table of Contents

# 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

System.Object
TcpCommunicationSpi

##### Implements

ICommunicationSpi

###### Namespace: Apache.Ignite.Core.Communication.Tcp

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public class TcpCommunicationSpi : object, 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 = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultConnectionsPerNode

Default value of ConnectionsPerNode property.

##### Declaration

    public const int DefaultConnectionsPerNode = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultConnectTimeout

Default value of ConnectTimeout property.

##### Declaration

    public static readonly TimeSpan DefaultConnectTimeout

##### Field Value

Type | Description
--- | ---
TimeSpan |

#### DefaultDirectBuffer

Default value of DirectBuffer property.

##### Declaration

    public const bool DefaultDirectBuffer = null

##### Field Value

Type | Description
--- | ---
System.Boolean |

#### DefaultDirectSendBuffer

Default value of DirectSendBuffer property.

##### Declaration

    public const bool DefaultDirectSendBuffer = null

##### Field Value

Type | Description
--- | ---
System.Boolean |

#### DefaultFilterReachableAddresses

Default value of FilterReachableAddresses property.

##### Declaration

    public const bool DefaultFilterReachableAddresses = null

##### Field Value

Type | Description
--- | ---
System.Boolean |

#### DefaultIdleConnectionTimeout

Default value of IdleConnectionTimeout property.

##### Declaration

    public static readonly TimeSpan DefaultIdleConnectionTimeout

##### Field Value

Type | Description
--- | ---
TimeSpan |

#### DefaultLocalPort

Default value of LocalPort property.

##### Declaration

    public const int DefaultLocalPort = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultLocalPortRange

Default value of LocalPortRange property.

##### Declaration

    public const int DefaultLocalPortRange = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultMaxConnectTimeout

Default value of MaxConnectTimeout property.

##### Declaration

    public static readonly TimeSpan DefaultMaxConnectTimeout

##### Field Value

Type | Description
--- | ---
TimeSpan |

#### DefaultMessageQueueLimit

Default value of MessageQueueLimit property.

##### Declaration

    public const int DefaultMessageQueueLimit = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultReconnectCount

Default value of ReconnectCount property.

##### Declaration

    public const int DefaultReconnectCount = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultSelectorsCount

Default value of SelectorsCount property.

##### Declaration

    public static readonly int DefaultSelectorsCount

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultSelectorSpins

Default value of SelectorSpins property.

##### Declaration

    public const long DefaultSelectorSpins = null

##### Field Value

Type | Description
--- | ---
System.Int64 |

#### DefaultSharedMemoryPort

Default value of SharedMemoryPort property.

##### Declaration

    public const int DefaultSharedMemoryPort = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultSocketBufferSize

Default socket buffer size.

##### Declaration

    public const int DefaultSocketBufferSize = null

##### Field Value

Type | Description
--- | ---
System.Int32 |

#### DefaultSocketWriteTimeout

Default value of SocketWriteTimeout property.

##### Declaration

    public const long DefaultSocketWriteTimeout = null

##### Field Value

Type | Description
--- | ---
System.Int64 |

#### DefaultTcpNoDelay

Default value of TcpNoDelay property.

##### Declaration

    public const bool DefaultTcpNoDelay = null

##### Field Value

Type | Description
--- | ---
System.Boolean |

#### DefaultUsePairedConnections

Default value of UsePairedConnections property.

##### Declaration

    public const bool DefaultUsePairedConnections = null

##### 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 |

#### ConnectionsPerNode

Gets or sets the number of connections per node.

##### Declaration

    public int ConnectionsPerNode { 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
--- | ---
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 |

#### FilterReachableAddresses

Gets or sets a value indicating whether filter for reachable addresses should be enabled on creating tcp client.

##### Declaration

    public bool FilterReachableAddresses { 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
--- | ---
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
--- | ---
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 |

#### SelectorSpins

Gets or sets a values that defines how many non-blocking selectors should be made. Can be set to so selector threads will never block.

Default value is DefaultSelectorSpins.

##### Declaration

    public long SelectorSpins { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int64 |

#### SharedMemoryPort

Gets or sets a local port to accept shared memory connections.

##### Declaration

    public int SharedMemoryPort { 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 |

#### SocketWriteTimeout

Gets or sets socket write timeout for TCP connection. If message can not be written to socket within this time then connection is closed and reconnect is attempted.

Default value is DefaultSocketWriteTimeout.

##### Declaration

    public long SocketWriteTimeout { get; set; }

##### Property Value

Type | Description
--- | ---
System.Int64 |

#### 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 |

#### UsePairedConnections

Gets or sets a value indicating whether separate connections should be used for incoming and outgoing data. Set this to `true` if ConnectionsPerNode should maintain connection for outgoing and incoming messages separately. In this case total number of connections between local and each remote node is equals to ConnectionsPerNode * 2.

##### Declaration

    public bool UsePairedConnections { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

### Implements

ICommunicationSpi