Practical mastering IBM MQ basics
Connection mode (4) client connection (3)
*This series may be revised based on the latest mqpgf/mqpcf. Please always download and use the latest version.
Learn about client channel workload balancing features.
Use the Channel Weight(CLNTWGHT) and Affinity(AFFINITY) parameters of the channel and the queue manager group in the Client Channel Definition Table(CCDT).
The operation mode is specified by AFFINITY.
Specify "NONE" or "PREFERRED (default)" for AFFINITY.
The client internally creates a list of channels according to the settings of AFFINITY and CLNTWGHT, and tries to connect according to the list.
"0"(default) value of CLNTWGHT is always placed at the top of the list.
If there is more than one "0", they will be arranged in alphabetical order by channel name.
When "1" to "99" is specified, "1" is the lowest and "99" is the highest priority.
It is not always listed according to this priority, and the higher the weight, the more likely it is to be listed higher.
*This list can not be viewed directly by the user.
Overview of the difference in behavior due to the setting of AFFINITY
In the case of AFFINITY(NONE), a list is generated each time MQCONN() is issued.
When MQCONN() is called from multiple applications on the same machine, separate lists are generated for each.
In the case of AFFINITY(PREFERRED), the list is generated when MQCONN() is first invoked in the same machine.
All client applications running on the same machine use the same list.
If CLNTWGHT is "0", it will remain at the top of the list even if it fails to connect, but channels other than "0" will be moved to the end of the list if it fails.
This will reduce the chances of trying to connect to a server that can not connect, but will continue to be at the end of the list after recovery.
Set CLNTWGHT and AFFINITY of the default queue manager group on the previously created queue manager group verification environment and check the behavior.
Behavior when AFFINITY is set to "NONE"
First, check when "NONE" is specified for AFFINITY.
Execute the script below to set up the parameters.
Channel parameter setting script
>type alterChl.mqsc
alter CHANNEL(CG.DEF1.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(3) AFFINITY(NONE)
alter CHANNEL(CG.DEF2.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(5) AFFINITY(NONE)
alter CHANNEL(CG.DEF3.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(0) AFFINITY(NONE)
alter CHANNEL(CG.DEF4.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(2) AFFINITY(NONE)
alter CHANNEL(CG.DEF5.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(0) AFFINITY(NONE)
>
Execution of channel parameter setting script
>runmqsc -n < alterChl.mqsc 5724-H72 (C) Copyright IBM Corp. 1994, 2018. 'AMQCLCHL.TAB' .... 1 : alter CHANNEL(CG.DEF1.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(3) AFFINITY(NONE) AMQ8016I: IBM MQ .... 2 : alter CHANNEL(CG.DEF2.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(5) AFFINITY(NONE) AMQ8016I: IBM MQ .... 3 : alter CHANNEL(CG.DEF3.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(0) AFFINITY(NONE) AMQ8016I: IBM MQ .... 4 : alter CHANNEL(CG.DEF4.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(2) AFFINITY(NONE) AMQ8016I: IBM MQ .... 5 : alter CHANNEL(CG.DEF5.MQI) CHLTYPE(CLNTCONN) CLNTWGHT(0) AFFINITY(NONE) AMQ8016I: IBM MQ .... >
Check if it is set correctly just in case.
>runmqsc -n 5724-H72 (C) Copyright IBM Corp. 1994, 2018. 'AMQCLCHL.TAB' dis chl(CG*) qmname conname clntwght affinity 1 : dis chl(CG*) qmname conname clntwght affinity AMQ8414I: .... CHANNEL(CG.DEF1.MQI) CHLTYPE(CLNTCONN) AFFINITY(NONE) CLNTWGHT(3) CONNAME(10.41.207.3(1414)) QMNAME( ) AMQ8414I: .... CHANNEL(CG.DEF2.MQI) CHLTYPE(CLNTCONN) AFFINITY(NONE) CLNTWGHT(5) CONNAME(10.41.207.3(1415)) QMNAME( ) AMQ8414I: .... CHANNEL(CG.DEF3.MQI) CHLTYPE(CLNTCONN) AFFINITY(NONE) CLNTWGHT(0) CONNAME(10.41.207.4(1414)) QMNAME( ) AMQ8414I: .... CHANNEL(CG.DEF4.MQI) CHLTYPE(CLNTCONN) AFFINITY(NONE) CLNTWGHT(2) CONNAME(10.41.207.4(1415)) QMNAME( ) AMQ8414I: .... CHANNEL(CG.DEF5.MQI) CHLTYPE(CLNTCONN) AFFINITY(NONE) CLNTWGHT(0) CONNAME(10.41.207.4(1416)) QMNAME( )
CG.DEF3.MQI(Server2: SampleQM) and CG.DEF5.MQI(Server2: PartialQM) are CLNTWGHT(0), so they should always be placed alphabetically at the top of the list. Except for these two queue managers, CLNTWGHT is set to other than "0", so the probability of being selected is determined according to its weight. Specifically, CG.DEF1.MQI(Server1: SampleQM) is 30%, CG.DEF2.MQI(Server1: RemoteQM) is 50%, and CG.DEF4.MQI(Server2: RemoteQM) is 20%.
Ex. 9.1.1 Workload Balancing with AFFINITY "NONE"
The command line to be executed from the client is as follows.
Specify MQCNO_RECONNECT to connect to other queue managers in the same queue manager group if a connection error is detected.
Instructs to call the normal event handler.
MQCONN() is called only once initially and repeats MQPUT() 100 times at 2 second intervals.
Then, 10 threads are started to perform those processes in parallel.
mqpgfc -qm "*" -q LQ1 -m test -ni 10 -tr -n 100 -i 2000 -cf EventHandler -op MQOP_REGISTER MQCBT_EVENT_HANDLER MQCNO_RECONNECT
*Option descriptions
-cf EventHandler: Use mqpgf/mqpgfc default event handler as callback function
-op MQOP_REGISTER: Set MQCB.Operation to MQOP_REGISTER
MQCBT_EVENT_HANDLER: Set MQCBD.CallbackType to MQCBT_EVENT_HANDLER
MQCNO_RECONNECT: Specify MQCNO_RECONNECT in MQCNO.Options
-ni: Start specified number of threads(MQCONN() calls each thread)
Perform the test according to the following procedure.
- (a) First start all queue managers.
- (b) Execute the mqpgfc command from the client.
- (c) Make sure that all 10 threads are connected to Server2:SampleQM.
- (d) Stop Server2:SampleQM with "endmqm -r".
- (e) Make sure that all 10 threads are reconnected to Server2:PartialQM.
- (f) Stop Server2:PartialQM with "endmqm -r".
- (g) Check the number of connections to the remaining 3 queue managers.
- Repeat the above five times.
The following is an example of one run.
*(a) First start all queue managers.
Server1: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Running)
Server2: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Running)
QMNAME(PartialQM) STATUS(Running)
*(b) Execute the mqpgfc command from the client.
>mqpgfc -qm "*" -q LQ1 -m test -ni 10 -tr -n 100 -i 2000 -cf EventHandler -op MQOP_REGISTER MQCBT_EVENT_HANDLER MQCNO_RECONNECT
[2018/10/23 11:29:37.252 tid=19980] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.253 tid=10356] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.256 tid=26552] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.266 tid=25972] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.267 tid=26564] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.269 tid=26484] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.271 tid=22516] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.276 tid=26568] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.278 tid=25564] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.280 tid=26560] MQCONNX start qmgr:* Options:0x01000000
[2018/10/23 11:29:37.482 tid=25972] MQCONNX stop hcon:33554440 qmgr:* CompCd=00 ReasonCd=00
[2018/10/23 11:29:37.482 tid=25972] MQCB start hcon:33554440
[2018/10/23 11:29:37.485 tid=25972] MQCB stop hcon:33554440 CompCd=00 ReasonCd=00
[2018/10/23 11:29:37.486 tid=25972] MQOPEN start hcon:33554440 ObjectName:LQ1 Options:0x00000010
[2018/10/23 11:29:37.507 tid=25972] MQOPEN stop hcon:33554440 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/10/23 11:29:37.508 tid=25972] 1: message length: 4 put message: test
....
*(c) Make sure that all 10 threads are connected to Server2:SampleQM.
Server2: mqpcf con -qm SampleQM APPLTAG |grep mqpgfc
18: CONN(414D514353616D706C65514D202020205BCE866F20002311) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
32: CONN(414D514353616D706C65514D202020205BCE866F20002D01) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
34: CONN(414D514353616D706C65514D202020205BCE866F20002E02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
36: CONN(414D514353616D706C65514D202020205BCE866F20002C02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
40: CONN(414D514353616D706C65514D202020205BCE866F20002A02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
42: CONN(414D514353616D706C65514D202020205BCE866F20002902) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
44: CONN(414D514353616D706C65514D202020205BCE866F20002802) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
46: CONN(414D514353616D706C65514D202020205BCE866F20002702) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
48: CONN(414D514353616D706C65514D202020205BCE866F20002602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
50: CONN(414D514353616D706C65514D202020205BCE866F20002502) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
*(d) Stop Server2 SampleQM with "endmqm -r".
Server2: endmqm -r SampleQM
Waiting for queue manager 'SampleQM' to end.
Quiesce request accepted. The queue manager will stop when all outstanding work
is complete.
*Client application starts automatic reconnection.
....
[2018/10/23 11:30:08.904 tid=26564] MQPUT start hcon:33554452 Options:0x00000000
[2018/10/23 11:30:08.910 tid=26564] MQPUT stop hcon:33554452 CompCd=00 ReasonCd=00
[2018/10/23 11:30:08.926 tid=25564] 16: message length: 4 put message: test
[2018/10/23 11:30:08.928 tid=25564] MQPUT start hcon:33554438 Options:0x00000000
[2018/10/23 11:30:08.933 tid=25564] MQPUT stop hcon:33554438 CompCd=00 ReasonCd=00
[2018/10/23 11:30:09.494] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.497] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.499] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.502] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.505] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.507] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.509] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.511] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.514] EVENT : Reconnecting (Delay: 97ms)
[2018/10/23 11:30:09.517] EVENT : Reconnecting (Delay: 97ms)
....
[2018/10/23 11:30:10.286] EVENT : Reconnected
....
[2018/10/23 11:30:11.401] EVENT : Reconnected
....
[2018/10/23 11:30:12.862] EVENT : Reconnected
....
[2018/10/23 11:30:13.928] EVENT : Reconnected
....
[2018/10/23 11:30:15.002] EVENT : Reconnected
....
[2018/10/23 11:30:16.131] EVENT : Reconnected
....
[2018/10/23 11:30:17.294] EVENT : Reconnected
....
[2018/10/23 11:30:18.408] EVENT : Reconnected
....
[2018/10/23 11:30:19.897] EVENT : Reconnected
[....
[2018/10/23 11:30:20.960] EVENT : Reconnected
....
[2018/10/23 11:30:20.961 tid=22516] 21: message length: 4 put message: test
[2018/10/23 11:30:20.970 tid=22516] MQPUT start hcon:33554448 Options:0x00000000
*(e) Make sure that all 10 threads are reconnected to Server2:PartialQM.
Server2: mqpcf con -qm PartialQM APPLTAG |grep mqpgfc
16: CONN(414D51435061727469616C514D2020205BCE868520002C02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
20: CONN(414D51435061727469616C514D2020205BCE868520002B02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
22: CONN(414D51435061727469616C514D2020205BCE868520002A02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
24: CONN(414D51435061727469616C514D2020205BCE868520002902) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
26: CONN(414D51435061727469616C514D2020205BCE868520002802) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
28: CONN(414D51435061727469616C514D2020205BCE868520002702) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
30: CONN(414D51435061727469616C514D2020205BCE868520002602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
32: CONN(414D51435061727469616C514D2020205BCE868520002502) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
34: CONN(414D51435061727469616C514D2020205BCE868520002402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
41: CONN(414D51435061727469616C514D2020205BCE868520002302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
※(f) Stop Server2:PartialQM with "endmqm -r".
Server2: endmqm -r PartialQM
Waiting for queue manager 'PartialQM' to end.
Quiesce request accepted. The queue manager will stop when all outstanding work
is complete.
*The client application starts automatic reconnection again.
....
[2018/10/23 11:30:41.565 tid=19980] MQPUT start hcon:33554444 Options:0x00000000
[2018/10/23 11:30:41.591 tid=19980] MQPUT stop hcon:33554444 CompCd=00 ReasonCd=00
[2018/10/23 11:30:41.705] EVENT : Reconnecting (Delay: 10ms)
[2018/10/23 11:30:41.714] EVENT : Reconnecting (Delay: 10ms)
[2018/10/23 11:30:41.726] EVENT : Reconnecting (Delay: 10ms)
[2018/10/23 11:30:41.738] EVENT : Reconnecting (Delay: 10ms)
[2018/10/23 11:30:41.748] EVENT : Reconnecting (Delay: 150ms)
....
[2018/10/23 11:30:43.867] EVENT : Reconnected
[2018/10/23 11:30:43.876] EVENT : Reconnecting (Delay: 0ms)
[2018/10/23 11:30:43.886] EVENT : Reconnecting (Delay: 0ms)
[2018/10/23 11:30:43.898] EVENT : Reconnecting (Delay: 0ms)
[2018/10/23 11:30:43.907] EVENT : Reconnecting (Delay: 0ms)
[2018/10/23 11:30:43.913] EVENT : Reconnecting (Delay: 0ms)
....
[2018/10/23 11:30:46.081] EVENT : Reconnected
....
[2018/10/23 11:30:48.215] EVENT : Reconnected
....
[2018/10/23 11:30:50.326] EVENT : Reconnected
....
[2018/10/23 11:30:52.731] EVENT : Reconnected
....
[2018/10/23 11:30:54.891] EVENT : Reconnected
....
[2018/10/23 11:30:57.017] EVENT : Reconnected
....
[2018/10/23 11:30:59.131] EVENT : Reconnected
....
[2018/10/23 11:31:01.246] EVENT : Reconnected
....
[2018/10/23 11:31:03.688] EVENT : Reconnected
[2018/10/23 11:31:04.605 tid=25564] MQPUT stop hcon:33554438 CompCd=00 ReasonCd=00
[2018/10/23 11:31:04.739 tid=26568] 37: message length: 4 put message: test
....
*(g) Check the number of connections to the remaining 3 queue managers.
*Server2:RemoteQM CLNTWGHT(2)
Server2: mqpcf con -qm RemoteQM APPLTAG |grep mqpgfc
46: CONN(414D514352656D6F7465514D202020205BCE754A20002F02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
*Server1:SampleQM CLNTWGHT(3)
Server1: mqpcf con -qm SampleQM APPLTAG |grep mqpgfc
31: CONN(414D514353616D706C65514D202020205BCE740020003202) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
35: CONN(414D514353616D706C65514D202020205BCE740020003102) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
39: CONN(414D514353616D706C65514D202020205BCE740020003002) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
*Server1:RemoteQM CLNTWGHT(5)
Server1: mqpcf con -qm RemoteQM APPLTAG |grep mqpgfc
11: CONN(414D514352656D6F7465514D202020205BCE741220002F02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
15: CONN(414D514352656D6F7465514D202020205BCE741220002E02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
17: CONN(414D514352656D6F7465514D202020205BCE741220002D02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
19: CONN(414D514352656D6F7465514D202020205BCE741220002C02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
23: CONN(414D514352656D6F7465514D202020205BCE741220002B02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
The following is the result of repeating the above 5 times and checking the number of connections to the remaining 3 queue managers. You can see that the connection is roughly in proportion to the weight.
Server2:RemoteQM | Server1:SampleQM | Server1:RemoteQM |
(CLNTWGHT:2) | (CLNTWGHT:3) | (CLNTWGHT:5) |
3 | 4 | 3 |
4 | 5 | 1 |
1 | 3 | 6 |
4 | 1 | 5 |
0 | 2 | 8 |
Total 12 connections | Total 15 connections | Total 23 connections |
24% | 30% | 46% |
After organizing, this test confirms the following:
- 1. CLNTWGHT with "0"(default) is always placed at the top of the list.
- 2. If there are multiple "0"s, they will be arranged in alphabetical order of channel names. In the case of AFFINITY(NONE):
- 3. A list is generated each time MQCONN() is called.
- 4. When MQCONN() is called from multiple applications(threads) of the same machine, separate lists are generated for each connection.
- 5. The higher the weight, the more likely it is to be listed higher.
The above was confirmed by invoking MQCONN() from each thread, but for reference, I will introduce a different test method. Please try variously.
Ex. 9.1.2 Workload Balancing with AFFINITY "NONE" (Other test method 1)
If you specify the queue manager group more than once as '-qm "*, *, *"' for the queue manager name, connections will be created for that number of times. Remember to specify MQCNO_HANDLE_SHARE_BLOCK or MQCNO_HANDLE_SHARE_NO_BLOCK to create a shared connection handle.
*Stop the queue manager with CLNTWGHT set to "0".
Server1: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Running)
Server2: dspmq
QMNAME(SampleQM) STATUS(Ended normally)
QMNAME(RemoteQM) STATUS(Running)
QMNAME(PartialQM) STATUS(Ended normally)
*Create three connections using the default queue manager group.
>mqpgfc -qm "*,*,*" -q LQ1 -m test -tr -n 100 -i 2000 -cf EventHandler -op MQOP_REGISTER MQCBT_EVENT_HANDLER MQCNO_RECONNECT MQCNO_HANDLE_SHARE_BLOCK
[2018/10/23 15:11:04.023] MQCONNX start qmgr:* Options:0x01000040
[2018/10/23 15:11:06.171] MQCONNX stop hcon:33554437 qmgr:* CompCd=00 ReasonCd=00
[2018/10/23 15:11:06.171] MQCB start hcon:33554437
[2018/10/23 15:11:06.171] MQCB stop hcon:33554437 CompCd=00 ReasonCd=00
[2018/10/23 15:11:06.171] MQCONNX start qmgr:* Options:0x01000040
[2018/10/23 15:11:08.377] MQCONNX stop hcon:33554439 qmgr:* CompCd=00 ReasonCd=00
[2018/10/23 15:11:08.378] MQCB start hcon:33554439
[2018/10/23 15:11:08.379] MQCB stop hcon:33554439 CompCd=00 ReasonCd=00
[2018/10/23 15:11:08.380] MQCONNX start qmgr:* Options:0x01000040
[2018/10/23 15:11:10.482] MQCONNX stop hcon:33554441 qmgr:* CompCd=00 ReasonCd=00
[2018/10/23 15:11:10.483] MQCB start hcon:33554441
[2018/10/23 15:11:10.484] MQCB stop hcon:33554441 CompCd=00 ReasonCd=00
[2018/10/23 15:11:10.485] MQOPEN start hcon:33554437 ObjectName:LQ1 Options:0x00000010
[2018/10/23 15:11:10.489] MQOPEN stop hcon:33554437 ObjectName:LQ1 CompCd=00 ReasonCd=00
....
*Confirm the connection destination.
Server1: mqpcf con -qm SampleQM APPLTAG |grep mqpgfc
12: CONN(414D514353616D706C65514D202020205BCE740020003C02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
Server1: mqpcf con -qm RemoteQM APPLTAG |grep mqpgfc
12: CONN(414D514352656D6F7465514D202020205BCE741220004402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
18: CONN(414D514352656D6F7465514D202020205BCE741220004302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
Server2: mqpcf con -qm RemoteQM APPLTAG |grep mqpgfc
Server2:
Ex. 9.1.3 Workload Balancing with AFFINITY "NONE" (Other test method 2)
Repeat from MQCONN() to MQDISC(). Specify the number of repetitions in the "-c" option. Stop using the "-s" option before calling MQDISC(), and check the connection destination.
>mqpgfc -qm "*" -q LQ1 -m test -tr -c 3 -s MQDISC -cf EventHandler -op MQOP_REGISTER MQCBT_EVENT_HANDLER MQCNO_RECONNECT MQCNO_HANDLE_SHARE_BLOCK
[2018/10/23 16:12:30.759] MQCONNX start qmgr:* Options:0x01000040
[2018/10/23 16:12:33.576] MQCONNX stop hcon:33554437 qmgr:* CompCd=00 ReasonCd=00
[2018/10/23 16:12:33.577] MQCB start hcon:33554437
[2018/10/23 16:12:33.578] MQCB stop hcon:33554437 CompCd=00 ReasonCd=00
[2018/10/23 16:12:33.579] MQOPEN start hcon:33554437 ObjectName:LQ1 Options:0x00000010
[2018/10/23 16:12:33.643] MQOPEN stop hcon:33554437 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/10/23 16:12:33.643] 1: message length: 4 put message: test
[2018/10/23 16:12:33.648] MQPUT start hcon:33554437 Options:0x00000000
[2018/10/23 16:12:33.683] MQPUT stop hcon:33554437 CompCd=00 ReasonCd=00
[2018/10/23 16:12:33.691] MQCLOSE start hcon:33554437 Options:0x00000000
[2018/10/23 16:12:33.710] MQCLOSE stop hcon:33554437 CompCd=00 ReasonCd=00
stop before calling MQDISC().
Hit Any Key!!!
Server1: mqpcf con -qm RemoteQM APPLTAG |grep mqpgfc
12: CONN(414D514352656D6F7465514D202020205BCE741220004602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
[2018/10/23 16:12:55.430] MQDISC start hcon:33554437
[2018/10/23 16:12:55.453] MQDISC stop hcon:-1 CompCd=00 ReasonCd=00
[2018/10/23 16:12:55.456] MQCONNX start qmgr:* Options:0x01000040
[2018/10/23 16:12:57.951] MQCONNX stop hcon:33554439 qmgr:* CompCd=00 ReasonCd=00
[2018/10/23 16:12:57.959] MQCB start hcon:33554439
[2018/10/23 16:12:57.965] MQCB stop hcon:33554439 CompCd=00 ReasonCd=00
[2018/10/23 16:12:57.970] MQOPEN start hcon:33554439 ObjectName:LQ1 Options:0x00000010
[2018/10/23 16:12:57.982] MQOPEN stop hcon:33554439 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/10/23 16:12:57.988] 1: message length: 4 put message: test
[2018/10/23 16:12:57.994] MQPUT start hcon:33554439 Options:0x00000000
[2018/10/23 16:12:58.015] MQPUT stop hcon:33554439 CompCd=00 ReasonCd=00
[2018/10/23 16:12:58.019] MQCLOSE start hcon:33554439 Options:0x00000000
[2018/10/23 16:12:58.032] MQCLOSE stop hcon:33554439 CompCd=00 ReasonCd=00
stop before calling MQDISC().
Hit Any Key!!!
Server2: mqpcf con -qm RemoteQM APPLTAG |grep mqpgfc
6: CONN(414D514352656D6F7465514D202020205BCEBB9220002402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
[2018/10/23 16:13:16.699] MQDISC start hcon:33554439
[2018/10/23 16:13:17.053] MQDISC stop hcon:-1 CompCd=00 ReasonCd=00
[2018/10/23 16:13:17.061] MQCONNX start qmgr:* Options:0x01000040
[2018/10/23 16:13:19.286] MQCONNX stop hcon:33554441 qmgr:* CompCd=00 ReasonCd=00
[2018/10/23 16:13:19.289] MQCB start hcon:33554441
[2018/10/23 16:13:19.291] MQCB stop hcon:33554441 CompCd=00 ReasonCd=00
[2018/10/23 16:13:19.292] MQOPEN start hcon:33554441 ObjectName:LQ1 Options:0x00000010
[2018/10/23 16:13:19.299] MQOPEN stop hcon:33554441 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/10/23 16:13:19.302] 1: message length: 4 put message: test
[2018/10/23 16:13:19.304] MQPUT start hcon:33554441 Options:0x00000000
[2018/10/23 16:13:19.346] MQPUT stop hcon:33554441 CompCd=00 ReasonCd=00
[2018/10/23 16:13:19.349] MQCLOSE start hcon:33554441 Options:0x00000000
[2018/10/23 16:13:19.370] MQCLOSE stop hcon:33554441 CompCd=00 ReasonCd=00
stop before calling MQDISC().
Hit Any Key!!!
Server1: mqpcf con -qm RemoteQM APPLTAG |grep mqpgfc
17: CONN(414D514352656D6F7465514D202020205BCE741220004605) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
Behavior when AFFINITY is set to "PREFERRED"
Next, check the behavior of "PREFERRED" for AFFINITY.
Execute the script below to set up the parameters.
AFFINITY only changed from "NONE" to "PREFERRED".
*The test with AFFINITY "PREFERRED" is carried out with MQ 9.1.0.0(LTS). Because defects were found at the time of the test, the following two individual fixes are applied to this version.
APAR IT26964 | Fixed that the connection destination that failed to connect, which will be described later, is not demoted. |
APAR IT26499 | Correspondence that Japanese display of command prompt is garbled in Windows version |
Channel parameter setting script
>type DefChlPreferred.mqsc:
* default queue manager group
def chl('CG.DEF1.MQI') CHLTYPE(CLNTCONN) CONNAME('16.147.169.58(18551)') CLNTWGHT(3) AFFINITY(PREFERRED) replace
def chl('CG.DEF2.MQI') CHLTYPE(CLNTCONN) CONNAME('16.147.169.58(18552)') CLNTWGHT(5) AFFINITY(PREFERRED) replace
def chl('CG.DEF3.MQI') CHLTYPE(CLNTCONN) CONNAME('16.147.169.198(18551)') CLNTWGHT(0) AFFINITY(PREFERRED) replace
def chl('CG.DEF4.MQI') CHLTYPE(CLNTCONN) CONNAME('16.147.169.198(18552)') CLNTWGHT(2) AFFINITY(PREFERRED) replace
def chl('CG.DEF5.MQI') CHLTYPE(CLNTCONN) CONNAME('16.147.169.198(18553)') CLNTWGHT(0) AFFINITY(PREFERRED) replace
The explanation of how to load the script and check the changes is omitted
CG.DEF3.MQI(Server2:SampleQM) and CG.DEF5.MQI(Server2:PartialQM) are CLNTWGHT(0). These should always be at the top of the list, even if a connection error occurs. Causes a connection error in CG.DEF2.MQI (Server1: RemoteQM), which has the highest weighting value (50%) in the queue manager for which CLNTWGHT is set to something other than "0". Then make sure that the channel is turned to the lower priority of the connection. Also make sure that all client applications running on the same machine use the same list.
Ex. 9.2.1 Workload Balancing with AFFINITY "PREFERRED" (1)
Perform the test according to the following procedure.
First, make sure CLNTWGHT: 0 never becomes at the bottom of the list.
The command options are the same as when testing AFFINITY "NONE".
- (a) First start all queue managers.
- (b) Execute two mqpgfc commands from the client.
- (c) Make sure that all 10 * 2 threads are connected to Server2:SampleQM(CLNTWGHT:0 top).
- (d) Stop Server2:SampleQM with "endmqm -r".
- (e) Confirm that all 10 * 2 threads are reconnected to Server2:PartialQM.
- (f) Start Server2:SampleQM.
- (g) Stop Server2:PartialQM with "endmqm -r".
- (h) Make sure that they are connected to Server2:SampleQM again. (CLNTWGHT:0 never become at the bottom of the list)
*(a) First, start all queue managers.
Server1: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Running)
Server2: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Running)
QMNAME(PartialQM) STATUS(Running)
*(b) Execute the mqpgfc command from the client.
Application1:
>mqpgfc -qm "*" -q LQ1 -m test -ni 10 -tr -n 100 -i 2000 -cf EventHandler -op MQOP_REGISTER MQCBT_EVENT_HANDLER MQCNO_RECONNECT
[2018/11/21 13:03:36.556 tid=28020] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=30348] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=27528] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=17992] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=29800] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=1408] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=27500] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=28760] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=29640] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:36.556 tid=20244] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:37.041 tid=20244] MQCONNX stop hcon:33554440 qmgr:* CompCd=00 ReasonCd=00
[2018/11/21 13:03:37.041 tid=20244] MQCB start hcon:33554440
[2018/11/21 13:03:37.056 tid=20244] MQCB stop hcon:33554440 CompCd=00 ReasonCd=00
[2018/11/21 13:03:37.056 tid=20244] MQOPEN start hcon:33554440 ObjectName:LQ1 Options:0x00000010
[2018/11/21 13:03:37.119 tid=20244] MQOPEN stop hcon:33554440 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/11/21 13:03:37.119 tid=20244] 1: message length: 4 put message: test
....
Application2:
>mqpgfc -qm "*" -q LQ1 -m test -ni 10 -tr -n 100 -i 2000 -cf EventHandler -op MQOP_REGISTER MQCBT_EVENT_HANDLER MQCNO_RECONNECT
[2018/11/21 13:03:39.447 tid=29516] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.447 tid=14832] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.447 tid=30676] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.447 tid=28788] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.447 tid=29852] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.447 tid=26964] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.462 tid=30632] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.462 tid=29624] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.462 tid=30104] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.462 tid=28976] MQCONNX start qmgr:* Options:0x01000000
[2018/11/21 13:03:39.619 tid=30676] MQCONNX stop hcon:33554444 qmgr:* CompCd=00 ReasonCd=00
[2018/11/21 13:03:39.619 tid=30676] MQCB start hcon:33554444
[2018/11/21 13:03:39.619 tid=30676] MQCB stop hcon:33554444 CompCd=00 ReasonCd=00
[2018/11/21 13:03:39.619 tid=30676] MQOPEN start hcon:33554444 ObjectName:LQ1 Options:0x00000010
[2018/11/21 13:03:39.634 tid=30676] MQOPEN stop hcon:33554444 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/11/21 13:03:39.634 tid=30676] 1: message length: 4 put message: test
....
*(c) Make sure that all 10 * 2 threads are connected to Server2:SampleQM(CLNTWGHT:0 top).
Server2: mqpcf con -qm SampleQM APPLTAG |grep mqpgfc
/home/okaqm9: mqpcf con -qm SampleQM APPLTAG |grep mqpgfc
29: CONN(414D514353616D706C65514D202020205BF4C54C20003702) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
31: CONN(414D514353616D706C65514D202020205BF4C54C20003602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
33: CONN(414D514353616D706C65514D202020205BF4C54C20003502) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
37: CONN(414D514353616D706C65514D202020205BF4C54C20003402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
40: CONN(414D514353616D706C65514D202020205BF4C54C20003302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
45: CONN(414D514353616D706C65514D202020205BF4C54C20003202) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
49: CONN(414D514353616D706C65514D202020205BF4C54C20003102) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
53: CONN(414D514353616D706C65514D202020205BF4C54C20003002) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
57: CONN(414D514353616D706C65514D202020205BF4C54C20002F02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
59: CONN(414D514353616D706C65514D202020205BF4C54C20002E02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
63: CONN(414D514353616D706C65514D202020205BF4C54C20002C01) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
65: CONN(414D514353616D706C65514D202020205BF4C54C20002D02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
69: CONN(414D514353616D706C65514D202020205BF4C54C20002B02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
71: CONN(414D514353616D706C65514D202020205BF4C54C20002902) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
73: CONN(414D514353616D706C65514D202020205BF4C54C20002802) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
75: CONN(414D514353616D706C65514D202020205BF4C54C20002702) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
77: CONN(414D514353616D706C65514D202020205BF4C54C20002602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
79: CONN(414D514353616D706C65514D202020205BF4C54C20002502) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
81: CONN(414D514353616D706C65514D202020205BF4C54C20002402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
88: CONN(414D514353616D706C65514D202020205BF4C54C20002302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
*(d) Stop Server2:SampleQM with "endmqm -r".
Server2: endmqm -r SampleQM
Waiting for queue manager 'SampleQM' to end.
Quiesce request accepted. The queue manager will stop when all outstanding work
is complete.
*Client applications start automatic reconnection.
Application1:
[2018/11/21 13:04:03.806 tid=30348] MQPUT start hcon:33554456 Options:0x00000000
[2018/11/21 13:04:03.822 tid=30348] MQPUT stop hcon:33554456 CompCd=00 ReasonCd=00
[2018/11/21 13:04:04.165 tid=20244] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.165 tid=29640] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.181 tid=28020] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.181 tid=30348] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.197 tid=17992] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.212 tid=29800] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.212 tid=28760] EVENT : Reconnecting (Delay: 31ms)
....
[2018/11/21 13:04:04.228 tid=27528] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.228 tid=1408] EVENT : Reconnecting (Delay: 31ms)
[2018/11/21 13:04:04.243 tid=27500] EVENT : Reconnecting (Delay: 31ms)
....
[2018/11/21 13:04:05.197 tid=27500] EVENT : Reconnected
....
[2018/11/21 13:04:06.369 tid=1408] EVENT : Reconnected
....
[2018/11/21 13:04:07.572 tid=27528] EVENT : Reconnected
....
[2018/11/21 13:04:08.759 tid=28760] EVENT : Reconnected
....
[2018/11/21 13:04:10.384 tid=29800] EVENT : Reconnected
....
[2018/11/21 13:04:11.775 tid=17992] EVENT : Reconnected
....
[2018/11/21 13:04:13.103 tid=30348] EVENT : Reconnected
....
[2018/11/21 13:04:14.275 tid=28020] EVENT : Reconnected
....
[2018/11/21 13:04:15.462 tid=29640] EVENT : Reconnected
....
[2018/11/21 13:04:16.665 tid=20244] EVENT : Reconnected
[2018/11/21 13:04:16.697 tid=27528] 18: message length: 4 put message: test
[2018/11/21 13:04:16.697 tid=27528] MQPUT start hcon:33554442 Options:0x00000000
....
Application2:
[2018/11/21 13:04:04.165 tid=30676] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.165 tid=29624] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.165 tid=28788] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.181 tid=28976] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.197 tid=30632] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.197 tid=14832] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.212 tid=29852] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.228 tid=26964] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.228 tid=30104] EVENT : Reconnecting (Delay: 240ms)
[2018/11/21 13:04:04.228 tid=29516] EVENT : Reconnecting (Delay: 240ms)
....
[2018/11/21 13:04:05.634 tid=29516] EVENT : Reconnected
....
[2018/11/21 13:04:06.822 tid=30104] EVENT : Reconnected
....
[2018/11/21 13:04:07.978 tid=26964] EVENT : Reconnected
....
[2018/11/21 13:04:09.165 tid=29852] EVENT : Reconnected
....
[2018/11/21 13:04:10.384 tid=14832] EVENT : Reconnected
....
[2018/11/21 13:04:11.775 tid=30632] EVENT : Reconnected
....
[2018/11/21 13:04:13.103 tid=28976] EVENT : Reconnected
....
[2018/11/21 13:04:14.275 tid=28788] EVENT : Reconnected
....
[2018/11/21 13:04:15.462 tid=29624] EVENT : Reconnected
....
[2018/11/21 13:04:16.665 tid=30676] EVENT : Reconnected
[2018/11/21 13:04:16.790 tid=26964] 17: message length: 4 put message: test
[2018/11/21 13:04:16.790 tid=26964] MQPUT start hcon:33554440 Options:0x00000000
....
*(e) Confirm that all 10 * 2 threads are reconnected to Server2:PartialQM.
Server2: mqpcf con -qm PartialQM APPLTAG |grep mqpgfc
1: CONN(414D51435061727469616C514D2020205BF4C57120002702) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
3: CONN(414D51435061727469616C514D2020205BF4C57120002602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
5: CONN(414D51435061727469616C514D2020205BF4C57120002502) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
7: CONN(414D51435061727469616C514D2020205BF4C57120002402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
14: CONN(414D51435061727469616C514D2020205BF4C57120002302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
44: CONN(414D51435061727469616C514D2020205BF4C57120003602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
46: CONN(414D51435061727469616C514D2020205BF4C57120003502) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
50: CONN(414D51435061727469616C514D2020205BF4C57120003402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
53: CONN(414D51435061727469616C514D2020205BF4C57120003302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
58: CONN(414D51435061727469616C514D2020205BF4C57120003202) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
62: CONN(414D51435061727469616C514D2020205BF4C57120003102) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
66: CONN(414D51435061727469616C514D2020205BF4C57120003002) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
70: CONN(414D51435061727469616C514D2020205BF4C57120002F02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
74: CONN(414D51435061727469616C514D2020205BF4C57120002E02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
76: CONN(414D51435061727469616C514D2020205BF4C57120002D02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
78: CONN(414D51435061727469616C514D2020205BF4C57120002C02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
82: CONN(414D51435061727469616C514D2020205BF4C57120002B02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
84: CONN(414D51435061727469616C514D2020205BF4C57120002A02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
86: CONN(414D51435061727469616C514D2020205BF4C57120002902) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
88: CONN(414D51435061727469616C514D2020205BF4C57120002802) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
....
※(f) Start Server2:SampleQM.
....
Server2: strmqm SampleQM
IBM MQ queue manager 'SampleQM' starting.
IBM MQ queue manager 'SampleQM' started using V8.0.3.0.
*(g) Stop Server2:PartialQM with "endmqm -r".
Server2: endmqm -r PartialQM
Waiting for queue manager 'PartialQM' to end.
Quiesce request accepted. The queue manager will stop when all outstanding work
is complete.
*The client applications start automatic reconnection again.
Application1:
[2018/11/21 13:05:06.009 tid=17992] EVENT : Reconnecting (Delay: 252ms)
[2018/11/21 13:05:06.009 tid=30348] EVENT : Reconnecting (Delay: 252ms)
[2018/11/21 13:05:06.024 tid=28020] EVENT : Reconnecting (Delay: 252ms)
[2018/11/21 13:05:06.056 tid=29640] EVENT : Reconnecting (Delay: 252ms)
[2018/11/21 13:05:06.056 tid=20244] EVENT : Reconnecting (Delay: 252ms)
[2018/11/21 13:05:06.087 tid=29800] EVENT : Reconnecting (Delay: 86ms)
[2018/11/21 13:05:06.087 tid=28760] EVENT : Reconnecting (Delay: 172ms)
[2018/11/21 13:05:06.087 tid=27528] EVENT : Reconnecting (Delay: 172ms)
[2018/11/21 13:05:06.087 tid=1408] EVENT : Reconnecting (Delay: 148ms)
[2018/11/21 13:05:06.103 tid=27500] EVENT : Reconnecting (Delay: 251ms)
....
[2018/11/21 13:05:07.712 tid=29800] EVENT : Reconnected
[2018/11/21 13:05:07.821 tid=20244] EVENT : Reconnected
[2018/11/21 13:05:07.884 tid=29640] EVENT : Reconnected
[2018/11/21 13:05:07.962 tid=28020] EVENT : Reconnected
....
[2018/11/21 13:05:08.384 tid=30348] EVENT : Reconnected
[2018/11/21 13:05:08.446 tid=17992] EVENT : Reconnected
....
[2018/11/21 13:05:08.509 tid=28760] EVENT : Reconnected
[2018/11/21 13:05:08.587 tid=27528] EVENT : Reconnected
....
[2018/11/21 13:05:08.696 tid=1408] EVENT : Reconnected
[2018/11/21 13:05:08.899 tid=27500] EVENT : Reconnected
[2018/11/21 13:05:09.165 tid=17992] MQPUT stop hcon:33554450 CompCd=00 ReasonCd=00
[2018/11/21 13:05:09.181 tid=28760] MQPUT stop hcon:33554448 CompCd=00 ReasonCd=00
....
Application2:
[2018/11/21 13:05:06.009 tid=29624] EVENT : Reconnecting (Delay: 177ms)
[2018/11/21 13:05:06.009 tid=30676] EVENT : Reconnecting (Delay: 177ms)
[2018/11/21 13:05:06.024 tid=28788] EVENT : Reconnecting (Delay: 33ms)
[2018/11/21 13:05:06.056 tid=28976] EVENT : Reconnecting (Delay: 142ms)
....
[2018/11/21 13:05:07.712 tid=28788] EVENT : Reconnected
[2018/11/21 13:05:07.728 tid=29516] EVENT : Reconnecting (Delay: 0ms)
[2018/11/21 13:05:07.728 tid=30104] EVENT : Reconnecting (Delay: 0ms)
[2018/11/21 13:05:07.728 tid=26964] EVENT : Reconnecting (Delay: 0ms)
[2018/11/21 13:05:07.743 tid=29852] EVENT : Reconnecting (Delay: 0ms)
[2018/11/21 13:05:07.743 tid=14832] EVENT : Reconnecting (Delay: 0ms)
[2018/11/21 13:05:07.743 tid=30632] EVENT : Reconnecting (Delay: 0ms)
[2018/11/21 13:05:07.853 tid=30676] EVENT : Reconnected
....
[2018/11/21 13:05:07.962 tid=29624] EVENT : Reconnected
....
[2018/11/21 13:05:08.415 tid=28976] EVENT : Reconnected
[2018/11/21 13:05:08.493 tid=30632] EVENT : Reconnected
[2018/11/21 13:05:08.571 tid=14832] EVENT : Reconnected
....
[2018/11/21 13:05:08.681 tid=29852] EVENT : Reconnected
[2018/11/21 13:05:08.853 tid=26964] EVENT : Reconnected
[2018/11/21 13:05:08.946 tid=30104] EVENT : Reconnected
[2018/11/21 13:05:09.181 tid=29516] EVENT : Reconnected
[2018/11/21 13:05:09.306 tid=30632] MQPUT stop hcon:33554438 CompCd=00 ReasonCd=00
[2018/11/21 13:05:09.337 tid=28976] MQPUT stop hcon:33554456 CompCd=00 ReasonCd=00
....
*(h) Confirm that they are connected to Server2:SampleQM again. (CLNTWGHT:0 never becomes a subordinate of the list)
Server2: mqpcf con -qm SampleQM APPLTAG |grep mqpgfc
3: CONN(414D514353616D706C65514D202020205BF4D96A20002B02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
5: CONN(414D514353616D706C65514D202020205BF4D96A20002902) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
7: CONN(414D514353616D706C65514D202020205BF4D96A20002802) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
9: CONN(414D514353616D706C65514D202020205BF4D96A20002702) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
11: CONN(414D514353616D706C65514D202020205BF4D96A20002602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
13: CONN(414D514353616D706C65514D202020205BF4D96A20002502) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
15: CONN(414D514353616D706C65514D202020205BF4D96A20002402) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
22: CONN(414D514353616D706C65514D202020205BF4D96A20002302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
52: CONN(414D514353616D706C65514D202020205BF4D96A20003702) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
54: CONN(414D514353616D706C65514D202020205BF4D96A20003501) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
56: CONN(414D514353616D706C65514D202020205BF4D96A20003602) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
61: CONN(414D514353616D706C65514D202020205BF4D96A20003302) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
63: CONN(414D514353616D706C65514D202020205BF4D96A20003403) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
68: CONN(414D514353616D706C65514D202020205BF4D96A20003101) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
70: CONN(414D514353616D706C65514D202020205BF4D96A20003202) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
78: CONN(414D514353616D706C65514D202020205BF4D96A20002F02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
80: CONN(414D514353616D706C65514D202020205BF4D96A20003003) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
84: CONN(414D514353616D706C65514D202020205BF4D96A20002E02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
86: CONN(414D514353616D706C65514D202020205BF4D96A20002C01) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
88: CONN(414D514353616D706C65514D202020205BF4D96A20002D02) TYPE(ALL) APPLTAG(....\mqpgfc.exe)
Ex. 9.2.2 Workload Balancing with AFFINITY "PREFERRED" (2)
Perform the test according to the following procedure.
Confirm that anything other than CLNTWGHT:0 becomes a subordinate of the list.
- 1. Start only queue managers with CLNTWGHT other than "0"(Server1:SampleQM, Server1:RemoteQM, Server2:RemoteQM).
- 2. Execute the mqpgfc command from the client.
- 3. Make sure that the first connection was made to Server1:RemoteQM with CLNTWGHT set to the highest value "5".
- 4. Stop Server1:RemoteQM.
- 5. Confirm that the 2nd connection was made to Server1:SampleQM with the next higher CLNTWGHT.
- 6. Start Server1:RemoteQM.
- 7. Make sure that the 3rd connection was made to Server1:SampleQM, which also has the second highest CLNTWGHT.(Server1:Remote QM was demoted)
- 8. Stop Server1:SampleQM.
- 9. Check that the 4th connection has been made to Server2:RemoteQM whose CLNTWGHT is set to the lowest value "2".(Server1:Sample QM was also demoted)
The command to execute is the following. Repeat MQCONN ... MQOPEN ... MQPUT ... MQCLOSE ... MQDISC ten times. Stop before calling MQCONN.
mqpgfc -qm "*" -q LQ1 -m test -c 5 -tr -s MQCONN
*Option descriptions
-tr: Simple API trace.
-c: Repeat MQCONN() to MQDISC() the specified number of times.
-s: Stop immediately before the specified MQI function and wait for input.
*1. Start only queue managers with CLNTWGHT other than "0"(Server1:SampleQM, Server1:RemoteQM, Server2:RemoteQM).
Server1: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Running)
Server2: dspmq
QMNAME(SampleQM) STATUS(Ended normally)
QMNAME(RemoteQM) STATUS(Running)
QMNAME(PartialQM) STATUS(Ended normally)
*2. Execute the mqpgfc command from the client.
>mqpgfc -qm "*" -q LQ1 -m test -c 5 -tr -s MQCONN
stop before calling MQCONN().
Hit Any Key!!!
[2018/11/21 14:00:28.861] MQCONN start qmgr:*
[2018/11/21 14:00:31.205] MQCONN stop hcon:33554438 qmgr:* CompCd=00 ReasonCd=00
[2018/11/21 14:00:31.220] MQOPEN start hcon:33554438 ObjectName:LQ1 Options:0x00000010
[2018/11/21 14:00:31.220] MQOPEN stop hcon:33554438 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/11/21 14:00:31.220] 1: message length: 4 put message: test
[2018/11/21 14:00:31.236] MQPUT start hcon:33554438 Options:0x00000000
[2018/11/21 14:00:31.251] MQPUT stop hcon:33554438 CompCd=00 ReasonCd=00
[2018/11/21 14:00:31.251] MQCLOSE start hcon:33554438 Options:0x00000000
[2018/11/21 14:00:31.267] MQCLOSE stop hcon:33554438 CompCd=00 ReasonCd=00
[2018/11/21 14:00:31.283] MQDISC start hcon:33554438
[2018/11/21 14:00:31.298] MQDISC stop hcon:-1 CompCd=00 ReasonCd=00
stop before calling MQCONN().
Hit Any Key!!!
※3. Make sure that the first connection was made to Server1:RemoteQM with CLNTWGHT set to the highest value "5".
Server1: mqpgf -qm RemoteQM -q LQ1 -r
[18/11/21 14:01:44.283964] 1: message length: 4 get message : test
no message available : LQ1 CompCd=02 ReasonCd=2033
*4. Stop Server1:RemoteQM.
$ endmqm RemoteQM
Quiesce request accepted. The queue manager will stop when all outstanding work is complete.
Server1: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Ended normally)
*5. Confirm that the 2nd connection was made to Server1:SampleQM with the next higher CLNTWGHT.
[2018/11/21 14:07:50.509] MQCONN start qmgr:*
[2018/11/21 14:08:02.509] MQCONN stop hcon:33554440 qmgr:* CompCd=00 ReasonCd=00
[2018/11/21 14:08:02.509] MQOPEN start hcon:33554440 ObjectName:LQ1 Options:0x00000010
[2018/11/21 14:08:02.509] MQOPEN stop hcon:33554440 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/11/21 14:08:02.509] 1: message length: 4 put message: test
[2018/11/21 14:08:02.509] MQPUT start hcon:33554440 Options:0x00000000
[2018/11/21 14:08:02.525] MQPUT stop hcon:33554440 CompCd=00 ReasonCd=00
[2018/11/21 14:08:02.525] MQCLOSE start hcon:33554440 Options:0x00000000
[2018/11/21 14:08:02.540] MQCLOSE stop hcon:33554440 CompCd=00 ReasonCd=00
[2018/11/21 14:08:02.540] MQDISC start hcon:33554440
[2018/11/21 14:08:02.556] MQDISC stop hcon:-1 CompCd=00 ReasonCd=00
stop before calling MQCONN().
Hit Any Key!!!
Server1: mqpgf -qm SampleQM -q LQ1 -r
[18/11/21 14:08:25.168192] 1: message length: 4 get message : test
no message available : LQ1 CompCd=02 ReasonCd=2033
*6. Start Server1:RemoteQM.
Server1: strmqm RemoteQM
IBM MQ queue manager 'RemoteQM' starting.
IBM MQ queue manager 'RemoteQM' started using V8.0.3.0.
Server1: dspmq
QMNAME(SampleQM) STATUS(Running)
QMNAME(RemoteQM) STATUS(Running)
Server2: dspmq
QMNAME(SampleQM) STATUS(Ended normally)
QMNAME(RemoteQM) STATUS(Running)
QMNAME(PartialQM) STATUS(Ended normally)
*7. Confirm that the 3rd connection was made to Server1:SampleQM which also has the second highest CLNTWGHT.(Server1:RemoteQM was demoted)
[2018/11/21 14:14:19.405] MQCONN start qmgr:*
[2018/11/21 14:14:21.780] MQCONN stop hcon:33554442 qmgr:* CompCd=00 ReasonCd=00
[2018/11/21 14:14:21.780] MQOPEN start hcon:33554442 ObjectName:LQ1 Options:0x00000010
[2018/11/21 14:14:21.780] MQOPEN stop hcon:33554442 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/11/21 14:14:21.780] 1: message length: 4 put message: test
[2018/11/21 14:14:21.795] MQPUT start hcon:33554442 Options:0x00000000
[2018/11/21 14:14:21.795] MQPUT stop hcon:33554442 CompCd=00 ReasonCd=00
[2018/11/21 14:14:21.795] MQCLOSE start hcon:33554442 Options:0x00000000
[2018/11/21 14:14:21.811] MQCLOSE stop hcon:33554442 CompCd=00 ReasonCd=00
[2018/11/21 14:14:21.826] MQDISC start hcon:33554442
[2018/11/21 14:14:21.826] MQDISC stop hcon:-1 CompCd=00 ReasonCd=00
stop before calling MQCONN().
Hit Any Key!!!
Server1: mqpgf -qm SampleQM -q LQ1 -r
[18/11/21 14:14:38.254752] 1: message length: 4 get message : test
no message available : LQ1 CompCd=02 ReasonCd=2033
*8. Stop Server1:SampleQM.
Server1: endmqm SampleQM
Quiesce request accepted. The queue manager will stop when all outstanding work is complete.
Server1: dspmq
QMNAME(SampleQM) STATUS(Ended normally)
QMNAME(RemoteQM) STATUS(Running)
Server2: dspmq
QMNAME(SampleQM) STATUS(Ended normally)
QMNAME(RemoteQM) STATUS(Running)
QMNAME(PartialQM) STATUS(Ended normally)
*9. Confirm that the 4th connection has been made to Server2:RemoteQM for which the lowest value "2" is set in CLNTWGHT.(Server1:SampleQM was also demoted)
[2018/11/21 14:18:37.272] MQCONN start qmgr:*
[2018/11/21 14:18:49.585] MQCONN stop hcon:33554444 qmgr:* CompCd=00 ReasonCd=00
[2018/11/21 14:18:49.585] MQOPEN start hcon:33554444 ObjectName:LQ1 Options:0x00000010
[2018/11/21 14:18:49.600] MQOPEN stop hcon:33554444 ObjectName:LQ1 CompCd=00 ReasonCd=00
[2018/11/21 14:18:49.616] 1: message length: 4 put message: test
[2018/11/21 14:18:49.616] MQPUT start hcon:33554444 Options:0x00000000
[2018/11/21 14:18:49.647] MQPUT stop hcon:33554444 CompCd=00 ReasonCd=00
[2018/11/21 14:18:49.663] MQCLOSE start hcon:33554444 Options:0x00000000
[2018/11/21 14:18:49.678] MQCLOSE stop hcon:33554444 CompCd=00 ReasonCd=00
[2018/11/21 14:18:49.678] MQDISC start hcon:33554444
[2018/11/21 14:18:49.710] MQDISC stop hcon:-1 CompCd=00 ReasonCd=00
stop before calling MQCONN().
Hit Any Key!!!
Server2: mqpgf -qm RemoteQM -q LQ1 -r
[18/11/21 14:18:52.337385] 1: message length: 4 get message : test
no message available : LQ1 CompCd=02 ReasonCd=2033
The connection demote disappears after restarting the application. Also, demote behavior does not affect other applications running in parallel.
About how connection list is generated
As mentioned at the beginning of this "Client channel workload balancing function", the connection list creation order is not necessarily the CLNTWGHT order. The higher the ratio of CLNTWGHT values, the higher the probability of being listed at the top. As a result, the list created between client machines using the same channel definition table will be different, enabling workload balancing. Also, once the list is created, it will be fixed on that machine unless the CLNTWGHT parameters are changed, etc. The connection list can not be viewed by the user. Finally, note that dropping/recreating the channel definition table does not recreate the list in case of the same parameters.(Result of this test)