Back to home page

Enduro/X

 
 

    


0001 TMQUEUE(8)
0002 ==========
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 tmqueue - Transactional Message Queue server.
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 *tmqueue* ['OPTIONS']
0014 
0015 
0016 DESCRIPTION
0017 -----------
0018 This is a special ATMI server that is used for transactional
0019 persistent message queue operations. *tmqueue* is backend server used by 
0020 *tpenqueue* and *tpdequeue()* calls. Queue server
0021 works in pair with *tmsrv(8)* instance, where both *tmqueue* and *tmsrv* are configured in
0022 XA environment with 'NDRX_XA_RMLIB=libndrxxaqdisk.so' (actual disk driver) and 
0023 *NDRX_XA_DRIVERLIB=libndrxxaqdisks.so* (static registration) or 
0024 *NDRX_XA_DRIVERLIB=libndrxxaqdiskd.so* (dynamic registration) driver loaders. 
0025 Related *tmsrv* instance shall be started first, before tmqueue process.
0026 
0027 Actual queue configuration is described either in configuration file *q.conf(5)*
0028 which may be present as a separate file or as part of the common-configuration ini section.
0029 
0030 Current storage backends uses file system for persistence. For more details on
0031 back-end configuration see *libndrxxaqdisks(8)*.
0032 
0033 The *tpenqueue(3)* and *tpdequeue(3)* can be invoked either as part of the global
0034  transaction or not. If global transaction is not used, then *tmqueue* will 
0035 open the transactions internally.
0036 
0037 The queue server internally uses thread pools for handling the work. Multiple 
0038 thread pools are used to avoid the deadlocking where internal processing might 
0039 do the XA driver calls which in the end sends notifications to the same server back.
0040 
0041 Three thread-pools are used:
0042 
0043 1) The first one is for accepting the ATMI *tpcall(3)* requests. 
0044 
0045 2) The second thread pool is used by forward services (which basically are senders
0046 for automatic queues). 
0047 
0048 3) The third thread pool is used by notifications received from transaction manager 
0049 (TM). TM notifies the queue server for XA operation progress (prepare, abort, commit).
0050 
0051 Every instance of *tmqueue* will advertise following list of services:
0052 
0053 1. @TMQ-<Cluster (or Virtual) Node ID>-<Server ID>
0054 
0055 2. @QSP<Queue space>
0056 
0057 For example for Queue Space 'MYSPACE', Cluster Node ID '6', Enduro/X Server ID '100'
0058 services will look like:
0059 
0060 1.  @TMQ-6-100
0061 
0062 2.  @QSPMYSPACE
0063 
0064 The automatic forwarder pool, ever configured time, will scan the automatic 
0065 queues for non-locked messages. Once such message is found, the message is 
0066 submitted for worker thread. The worker thread will do the synchronous call to 
0067 target server ('srvnm' from 'q.conf'), wait for answer and either update tries 
0068 counter or remove the message if succeed. If message is submitted with 'TPQREPLYQ' 
0069 then on success, the response message from invoked service is submitted to 
0070 reply queue. If message destination service fails for number of attempts,
0071 then message is forwarded to 'TPQFAILUREQ', in this case original 'TPQCTL' is preserved.
0072 
0073 Tmqueue server is optimized for waking up the forwarder dispatch thread if new processable
0074 message is enqueued in automatic queue. If thread which enqueued new message detects
0075 that forwarder thread sleeps, then immediate forwarder thread wakeup is performed.
0076 This approach does not synchronize fully with dispatcher thread (for performance
0077 reason), thus it might be still possible that scan time sleep is done, even processable
0078 message was enqueued.
0079 
0080 During the startup, *tmqueue* will read messages from the XA backend driver. 
0081 All messages are read. All active messages found in persistent storage are rolled
0082 back at startup. Only prepared and committed commands/messages are read and stored in
0083 message lists. Any prepared commands automatically puts the lock marking on 
0084 corresponding messages.
0085 
0086 In case if *tmqueue* was shutdown with incomplete transactions:
0087 
0088 - Active transactions are rolled back at startup. Any request from tmsrv regarding
0089 these transactions will return *XAER_NOTA* error.
0090 
0091 - Tmsrv may rollback any prepared transaction (if needed).
0092 
0093 - If for some reason tmsrv lost the track of any prepared transaction, 
0094 *tmrecovercl(8)*, *tmrecoversv(8)* may be used to rollback such prepared transactions.
0095 
0096 
0097 Tmqueue server for any transaction keeps internal accounting with active transaction
0098 expiry setting. If transaction is not completed in given time frame, the tmqueue
0099 will automatically rollback the transaction.
0100 
0101 For more usage of the persistent queues, configuration, command line and codding samples, 
0102 see *atmitests/test028_tmq* folder.
0103 
0104 
0105 OPTIONS
0106 -------
0107 
0108 [*-q* 'QUEUE_CONFIG']::
0109 This is either full or relative path to the queue definition file (see 'q.conf(5)' 
0110 for more info on syntax. When changes are done in this file, it is possible to 
0111 reload the configuration during the runtime, with 'xadmin mqrc' command. Note 
0112 that queues are not removed, but changed or added. If flag is not set,
0113 then data is searched in *[@queue]* ini section. And uses *<cctag>* for
0114 sub-section search, if multiple Q-spaces are defined. Firstly it attempts 
0115 to load form this flag-specified configuration file, afterwards attempt is 
0116 made to load from CConfig if available.
0117 
0118 [*-s* 'SCAN_TIME']::
0119 This time in seconds used by main forwarder thread to scan for any automatic 
0120 messages to be submitted for processing.
0121 
0122 [*-p* 'SERVICE_THREAD_POOL_SIZE']::
0123 This is thread pool size of used for *tpenqueue()*, *tpdequeue()* serving. 
0124 Also this thread pool is utilized by *xadmin* 'mqX' commands. Default is *10*.
0125 
0126 [*-u* 'NOTIFY_THREAD_POOL_SIZE']::
0127 This is number of threads which are processing callbacks from XA driver 
0128 (for operation completion notifications). Default value is *10*.
0129 
0130 [*-f* 'FORWARD_THREAD_POOL_SIZE']::
0131 This is number of worker threads for forwarder. Default value is *10*.
0132 
0133 [*-t* 'XA_TRANSACTION_TIMEOUT']::
0134 Maximum number of seconds to wait for XA transaction to be completed. This used 
0135 internally when global transactions are not used. Default is *30*.
0136 
0137 [*-T* 'XA_SESSION_TIMEOUT']::
0138 Session timeout for in-active transactions in seconds - if transaction is not completed 
0139 ( no *tpcommit(3)* or *tpabort(3)* performed), or new *tpenqueue(3)* or *tpdequeue(3)*
0140 is not performed in given time frame, the transaction internally is rolled back. 
0141 When new *tpenqueue(3)* or *tpdequeue(3)* is performed in the global transaction,
0142 the time-out counter is reset. After internal rollback any further enqueue/dequeue 
0143 operations in global transaction will return  *TPETRAN* error. Commit of such global 
0144 transaction would be terminated with *TPEABORT*. Value *0* disables transaction 
0145 sessions checks. It is strongly discouraged to use *0*, as this in case of system 
0146 error may lock resources until the tmqueue server process is restarted. 
0147 Default value is *180*.
0148 
0149 [*-N*]::
0150 If flag is set, the enqueue operations will not trigger immediate forwarder
0151 thread wakeup.
0152 
0153 [*-n* 'ENDUROX_NODE_ID']::
0154 Indicates the virtual Enduro/X cluster node ID. If the parameter is not set, then
0155 given parameter matches the local application domain node ID set in *NDRX_NODEID*
0156 environment variable. Parameter normally is set to some common cluster node id
0157 number for singleton process group operations. So that in case of group failover,
0158 the tmqueue server from shared storage would read, recognize and process 
0159 failed (other) node's persisted messages. Additionally, it is required that <srvid>
0160 for the <server> tag in *ndrxconfig.xml(5)* used by tmqueue matches the 
0161 failed nodes <srvid> value. At event of group failover to other Enduor/X node,
0162 if Node ID or Server ID does not match, existing stored messages would be ignored.
0163 
0164 [*-X* 'NR_OF_SECONDS']::
0165 Number of seconds for periodic verification of the committed message directory. Functionality
0166 is enabled in case if value is greater than *0*. Granularity of the flag
0167 is set by *-s* parameter. Processing of committed directory scans are done
0168 by notification thread (from the thread pool, setting *-u*).
0169 Verification process ensures that all messages on the disk are loaded into
0170 memory, which is normal operation of the *tmqueue*. If any unregistered
0171 message is found on the disk, that triggers *tmqueue* to restart (load all
0172 messages from the disk and continue operations. Note that restart would
0173 abort any active *tmqueue* transactions) and for restart period of time
0174 (including time needed for queue space message reading and loading from
0175 the disk to memory), the queue space would not be available.
0176 Normally setting is not required, however with singleton failover groups
0177 if in the cluster STONITH device is not used with the shared file system
0178 and if shared file system does not become read-only or un-available at the moment of the failure,
0179 for certain node failures and node removal from the cluster scenarios
0180 (such as node suspend, timeout, other node takes the lock, and then
0181 failed node is resumed), for small period of time duplicate runs of the
0182 *tmqueue* processes might be possible. During this duplicate run there
0183 is small chance that message is moved to committed directory by the
0184 lock lost *tmqueue* instance and that new activated instance would not see
0185 that message. To protect against such cases, flag *-X* is recommended,
0186 however the value shall not trigger checks very often, as directory listing
0187 operations on large shared file systems might be slow.
0188 The value such as *60* (once per two minutes) or
0189 greater would be recommended, however this depends on system criticality
0190 and requirements of the message availability, as if such chance of
0191 unregistered committed message happens, the *tmqueue* during the
0192 operations would not be able to dequeue or forwards the message.
0193 
0194 LIMITATIONS
0195 -----------
0196 When commit is performed for several enqueued messages within a global transaction,
0197 each message is unblocked (made available in queue space for dequeue or automatic
0198 forward) separately, message by message. This means that during the commit
0199 execution, even though commit is not completed yet, part of the messages will
0200 appear as committed.
0201 
0202 Flag *NOJOIN* is not supported for XA libndrxxaqdisks and libndrxxaqdiskd drivers.
0203 
0204 Only *1* tmqueue server is allowed per queue space. Thus it is mandatory that
0205 '<min>' and '<max>' tags are set to *1*. Otherwise incorrect queue logic
0206 may be expected.
0207 
0208 
0209 EXIT STATUS
0210 -----------
0211 *0*::
0212 Success
0213 
0214 *1*::
0215 Failure
0216 
0217 BUGS
0218 ----
0219 Report bugs to support@mavimax.com
0220 
0221 SEE ALSO
0222 --------
0223 *xadmin(8)* *q.conf(5)* *ex_env(5)* *tmsrv(8)* *libndrxxaqdisks(8)*
0224 
0225 COPYING
0226 -------
0227 (C) Mavimax, Ltd
0228