tpbridge - Enduro/X Bridge Server.
This is special ATMI server which is used to connect local ATMI instances
over the network. The result is network joined instances which makes
EnduroX cluster.
Bridge process is used to exchange service lists between two nodes,
calculate monotonic clock diff (so that later for messages time can
be adjusted) between nodes.
To establish network connection, on one machine it must be in passive mode
and on other machine it must be in active mode. Active tpbridge periodically
tries to connect to the other machine. To one passive bridge only one
connection can be made.
If connection is dropped, active node will re-try to connect.
All data messages are prefixed with 4 byte message length indicator.
Meaning that the logical message can be split over the multiple packets or
within one packed can be carried multiple logical messages - tpbridge will
solve that.
When connection is established, clock diff and service lists are exchanged,
then bridge is used to serve ATMI actions over the machines. I.e. tpcall(),
tpforward(), conversations, etc.
When connection is stopped. This is reported to ndrxd daemon which
removes services from shared memory accordingly.
tpbridge supports two network message formats. First format is native format
which sends over the network directly internal (C lang) structures. This format
will work faster, but cannot be used between different type of computers.
I.e. in this case it is not possible to mix for example x86_64 with x86. Or
x86 with RISC/ARM 32bit.
If mixing is necessary, then use Enduro/X Network Protocol option, activated by
flag -f on both nodes. In this case standard common TLV data format is used
for data exchange between nodes. This might be slower than native format.
When using host name (-h) for resolving binding host or connection address,
tpbridge will resolve IP addresses. Multiple IP addresses for host name are
supported. The logic for using them is following:
In case of binding (server):
-
Query host name
-
Select first IP found in list
-
Try to bind to selected IP
-
If bind failed with EADDRINUSE or EADDRNOTAVAIL, select next IP, continue with 3.
-
If list of IP addresses are exhausted, start with 1.
In case of connecting to address (client):
-
Query host name
-
Select first IP found in list
-
Perform connect() to selected IP
-
If connect() asynchronously failed (after EINPROGRESS) with any error,
select next IP, continue with 3.
-
If list of IP addresses are exhausted, start with 1.
-
-n NODE_ID
-
Other Enduro/X instance’s Node ID. Numerical 1..32.
-
[-r]
-
Send Refresh messages to other node. If not set, other node will
not see our’s node’s services. OPTIONAL flag.
-
-t MODE
-
MODE can be P for passive/TCPIP server mode, any other (e.g. A)
will be client mode.
-
-i IP_ADDRESS
-
In Active mode it is IP address to connect to. In passive mode it is
binding/listen address.
-
-h HOST_NAME
-
Binding/connection IP Address may be resolved from host name set in -h parameter.
Host name is resolved by OS, DNS queries, etc. tpbridge shall be started with
-i or with -h, if both flags will be set, error will be generated.
-
-6
-
If set, then IPv6 addresses will be used. By default tpbridge operates with
IPv4 addresses.
-
-p PORT_NUMBER
-
In active mode PORT_NUMBER is port to connect to. In passive mode it is
port on which to listen for connection.
-
-T TIME_OUT_SEC
-
Parameter indicates time-out value for packet receive in seconds. This is
socket option. Receive is initiate when it either there is poll even on socket
or incomplete logical message is received and then next recv() is called.
If the message part is not received in time, then socket is closed and connection
is restarted. This parameter also is used in case if target socket to which msg
is being sent is full for this given time period. If msg is not fully sent
and time out is reached, the connection is restarted, outgoing msg is being dropped.
-
[-b BACKLOG_NR]
-
Number of backlog entries. This is server’s (passive mode) connection queue, before
server accepts connection. OPTIONAL parameter. Default value is 100. But
could be set to something like 5.
-
[-c CONNECTION_CHECK_SEC]
-
Connection check interval in seconds. OPTIONAL parameter. Default value 5.
-
[-z PERIODIC_ZERO_SEND_SEC]
-
Interval in seconds between which zero length message is wrote to socket.
This is useful to keep the connection option over the firewalls, etc.
OPTIONAL parameter. Default value 0 (Do not send).
-
[-a INCOMING_RECV_ACTIVITY_SEC]
-
If set, then this is maximum time into which some packet from network must be
received. If no receive activity on socket is done, the connection is reset.
The 0 value disables this functionality. The default value is -z
multiplied by 2. Note that checks are performed with -c interval.
intervals. Usually this is used with -z, so that it is guaranteed that during
that there will be any traffic.
-
[-f]
-
Use Enduro/X Standard Network TLV Protocol instead of native data structures
for sending data over the network. This also ensure some backwards compatibility
between Enduro/X versions. But cases for backwards compatibility must be checked
individually.
-
[-P THREAD_POOL_SIZE]
-
This is number of worker threads for sending and receiving messages
for/to network. 50% of the threads are used for upload and other 50% are
used for network download. Thus number is divided by 2 and two thread pools
are created. If divided value is less than 1, then default is used.
The default size is 4.
-
[-R QUEUE_RETRIES]
-
Number of attempts to send message to local queue, if on pervious attempt queue
was full. The first attempt is done in real time, any further (if this flag allows)
are performed with CONNECTION_CHECK_SEC interval. Default value is 3.