Author |
Message
|
chris boehnke |
Posted: Sat Mar 19, 2011 6:10 pm Post subject: MQ load balancing with CCDT |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
Hi Guys,
We are using MQ 7.0.1.4 on Linux.
We have 2 queue managers running on 2 servers.. say QM1 on Server1 & QM2 on Server2.
We have a client application which should send messages onto QM1 and QM2.
Question:
Is it possible to achieve load balancing with client channel definition table(CCDT) to send messages to both QMgrs - QM1 & QM2 in round robin fashion?.
Thanks,
Sampath |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Mar 19, 2011 6:45 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
V7 has a parameter for the client channel which allows you to determine what percentage of calls goes to which connection.
This should allow you to meet your requirement.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
chris boehnke |
Posted: Sat Mar 19, 2011 7:33 pm Post subject: |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
fjb_saper wrote: |
V7 has a parameter for the client channel which allows you to determine what percentage of calls goes to which connection.
This should allow you to meet your requirement.
Have fun  |
Is the parameter 'CLNTWGHT' on CLNTCONN channel?. When I look at the documentation, I found this link: http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzae.doc/ic19840_.htm
As the client needs to load balance across QM1(Server1) and QM2(server2), do I need to set the CLNTWGHT to equal value(say 2) for QM1 & QM2 CLNTCONN channels defined on any one of the QMgr?
Please confirm me.
Thanks. |
|
Back to top |
|
 |
chris boehnke |
Posted: Sat Mar 19, 2011 8:35 pm Post subject: |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
When I look at the section 5.7.1 & 5.7.2 of the redbook: http://www.redbooks.ibm.com/redbooks/pdfs/sg247583.pdf
My understandings are need to define the CLNTCONN channels with below parameters:
*Both CLNTCONN channels need to be defined with CLNTWGHT(50) AFFINITY(NONE)*. With the equal CLNTWGHT, it will distribute the load between 2 queue managers for each qmgr connection and with AFFINITY(NONE) the QMgr connection is random. With this the traffic will be load balanced between QMgrs - QM1 & QM2 from the client application by using CCDT just like MQ clustering load balancing.
Define the SVRCONN channels on each of the QM1 & QM2 and both CLNTCONN channels on one of the qmgr(either QM1 or QM2) and export the CCDT table onto client machine. Here I am defining both CLNTCONN channels on QM1.
Quote: |
QM1 (on Server1)
Define SVRCONN channel
DEFINE CHL(QM1.CLIENT) CHLTYPE(SVRCONN) TRPTYPE(TCP)
Define CLNTCONN for QM1
DEFINE CHL(QM1.CLIENT) CHLTYPE(CLNTCONN) TRPTYPE(TCP) CONNAME(server1(1414)) CLNTWGHT(50) AFFINITY(NONE) QMGR(QM*)
Define CLNTCONN for QM2
DEFINE CHL(QM2.CLIENT) CHLTYPE(CLNTCONN) TRPTYPE(TCP) CONNAME(server2(1415)) CLNTWGHT(50) AFFINITY(NONE) QMGR(QM*)
QM2 (on Server2)
Define SVRCONN channel
DEFINE CHL(QM2.CLIENT) CHLTYPE(SVRCONN) TRPTYPE(TCP) |
Please correct/ confirm my understandings.
Thanks for your help. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Mar 20, 2011 5:48 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Looks correct. Have you tried it? What was the result?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
bruce2359 |
Posted: Sun Mar 20, 2011 6:36 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
These parameters are well documented. Keep in mind that the algorithm is somewhat complicated; and the results are not guaranteed. Your expectations for exactly 50 percent going to one qmgr might not be met. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
bruce2359 |
Posted: Sun Mar 20, 2011 6:51 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
fjb_saper wrote: |
V7 has a parameter for the client channel which allows you to determine what percentage of calls goes to which connection.
This should allow you to meet your requirement. |
The key word is percentage. This is not a guarantee as to exactly and precisely how many (numerically) messages will be distributed to the two qmgrs. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Sun Mar 20, 2011 12:53 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
If you are only using MQ 7.0.1* CCDTs, the messages won't be load balanced at all. The connections can be if the CCDT is set up right. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
bruce2359 |
Posted: Sun Mar 20, 2011 1:53 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
PeterPotkay wrote: |
... The connections can be if the CCDT is set up right. |
And presuming that there are no issues with the qmgrs or svrconn channels, ... _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
chris boehnke |
Posted: Sun Mar 20, 2011 2:36 pm Post subject: |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
PeterPotkay wrote: |
If you are only using MQ 7.0.1* CCDTs, the messages won't be load balanced at all. The connections can be if the CCDT is set up right. |
Can you please elaborate on this?.
You mean the the above procedure what I am planning to use doesn't work?.
Thanks. |
|
Back to top |
|
 |
bruce2359 |
Posted: Sun Mar 20, 2011 3:10 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
The procedure you are contemplating may work; but then again, it might not. It will depend on when your app next tries to connect, and put a message to a queue.
WMQ software makes no guarantees as to the qmgr your app connects to, or that it will successfully connect, or that a message will be delivered to a specific queue. If you have to ask why this is so, you don't understand the WMQ product
The CCDT only offers possible qmgrs for the app to connect to. What if one, some or all, of the qmgrs defined in the CCDT become unavailable? What if the qmgr the app connects to suddenly becomes unavailable before the mqput? What if the destination queue becomes unavailable?
The channel (and other) v7 attributes offer weighting values; and based on the values you specify, the selection algorithm attempts to find a best fit. Again, no guarantees. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Mar 20, 2011 9:18 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
However in "a perfect world" your connections will be balanced as indicated by the weight set on the channels ...
So try it already and let us know how you fared...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
chris boehnke |
Posted: Sun Mar 27, 2011 6:03 pm Post subject: |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
I tried to validate it. here are the results:
1. Able to send messages to both QMgrs with AFFINITY(NONE).
2. Tried to change the CLNTWGHT parameter but dont see any benefit or difference in sending the messages based on weight (atleast I didn't observe much difference). Could be because I was sending 1 message at a time with RFHUTILC and not a batch job with bunch of messages at a time.
3. The load balancing is only for the 'client connections'. If the client app doesn't disconnect, all the messages are routed to that connected QMgr and not to the 2nd Qmgr. If the client can disconnect for each PUT(or couple of PUTs), then only we see messages kind of load balanced between both Qmgrs. If the client app needs to disconnect its connection every time, its a performance overhead as every client connection needs to authorized/ authenticated from security perspective and needs to connect/ disconnect its connection which is also an overhead.
4. Even if the app disconnects its connection for every PUT, the load balancing is not like MQ load balancing and it is Percentage as discussed in above responses.
Let me know your thoughts/ suggestions.
Thanks. |
|
Back to top |
|
 |
bruce2359 |
Posted: Sun Mar 27, 2011 7:07 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Try similar tests, but with a file of 50 messages - with sequence numbers in positions 1 and 2 (like 01, 02, 03...).
Use the supplied amqsput utility to put messages from the file.
Start with a simple test, like queue weighting at 50/50%. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Mar 27, 2011 8:28 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Looks to me like this is going to be more efficient in an environment where you have a connection pool and are possibly using a different connection from the pool for each message. Ideal for a J2EE environment yes?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|