Author |
Message
|
Gideon |
Posted: Mon Sep 09, 2013 12:18 pm Post subject: How to increase connections |
|
|
Chevalier
Joined: 18 Aug 2009 Posts: 403
|
I have a program that is creating connections (connection factory) through a SVRCONN. All is working well
Until I hit the 50th thread, where the java code says something to the effect that no more connections are possible with this channel.
How Can I increase the number of connections that are available for a single svrconn channel ?
Thanks |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Sep 09, 2013 12:39 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Give us a clue. What version of MQ? What version of MQ Client? Anything else you can think of. _________________ 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 |
|
 |
Gideon |
Posted: Mon Sep 09, 2013 12:54 pm Post subject: |
|
|
Chevalier
Joined: 18 Aug 2009 Posts: 403
|
Server 7.5.0.1
Client: 7.6.0.1
Channel Charconv(1) |
|
Back to top |
|
 |
PaulClarke |
Posted: Mon Sep 09, 2013 1:19 pm Post subject: |
|
|
 Grand Master
Joined: 17 Nov 2005 Posts: 1002 Location: New Zealand
|
Do you get any error messages on the server? What is your value of MaxChannels. By default it has the rather lowly value of 100. Many users set this value in a number of thousands.
Cheers,
P. _________________ Paul Clarke
MQGem Software
www.mqgem.com |
|
Back to top |
|
 |
gbaddeley |
Posted: Mon Sep 09, 2013 3:50 pm Post subject: Re: How to increase connections |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
Gideon wrote: |
I have a program that is creating connections (connection factory) through a SVRCONN. All is working well
Until I hit the 50th thread, where the java code says something to the effect that no more connections are possible with this channel.
How Can I increase the number of connections that are available for a single svrconn channel ?
Thanks |
Are you sure your program is working correctly? What's to say that the problem won't happen again after you increase the maxchannels to 100, 500, 1000 ? _________________ Glenn |
|
Back to top |
|
 |
Gideon |
Posted: Tue Sep 10, 2013 11:45 am Post subject: |
|
|
Chevalier
Joined: 18 Aug 2009 Posts: 403
|
I am using WMQ 7.5 with the default MaxChannels (100)
I have a program that starts as many threads and connections as possible:
Code: |
class Msg {
public void Send() {
......
try {
JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);
JmsConnectionFactory cf = ff.createConnectionFactory();
cf.setStringProperty(WMQConstants.WMQ_CONNECTION_NAME_LIST, conList);
cf.setIntProperty(WMQConstants.WMQ_CLIENT_RECONNECT_OPTIONS, WMQConstants.WMQ_CLIENT_RECONNECT);
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, qmgr);
connection = cf.createConnection();
session = connection.createSession(txEnabled ? true : false, Session.AUTO_ACKNOWLEDGE);
queue = session.createQueue(qName);
producer = session.createProducer(queue);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
connection.start();
}
catch (JMSException jmsex) {
////
}
.......
}
} // end Msg class
// =============================================================
class SimpleThread extends Thread {
public SimpleThread(String str) {
super(str);
}
public void run() {
Msg msg = new Msg();
msg.Send();
}
}
//---------------------------------------------------------
public class Cn {
public static void main (String args[]) {
int thds = 1;
System.out.println("Total Connections with each thread sending at 1 msg per second " );
while ( thds < 100 ) {
new SimpleThread("Jamaica").start();
System.out.println(" Threads: " + thds);
thds = thds + 1;
try{
Thread.currentThread().sleep(1000);//sleep for 1000 ms
}
catch(InterruptedException ie){
//If this thread was intrrupted by nother thread
}
}
}
}
|
I eventually get the following error
Code: |
Threads: 33
Threads: 34
Threads: 35
Threads: 36
Threads: 37
Threads: 38
Threads: 39
Threads: 40
Threads: 41
Threads: 42
Threads: 43
Threads: 44
Threads: 45
Threads: 46
Threads: 47
Threads: 48
Threads: 49
Threads: 50
-- Send: Config error
com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: Failed to connect to qu
eue manager 'mqha2' with connection mode '1' and host name '10.14.101.196(1414),
10.14.101.197(1414)'.
Check the queue manager is started and if running in client mode, check there is
a listener running. Please see the linked exception for more information.
Inner exception(s):
com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' (
'MQCC_FAILED') reason '2537' ('MQRC_CHANNEL_NOT_AVAILABLE').
com.ibm.mq.jmqi.JmqiException: CC=2;RC=2537;AMQ9204: Connection to host '10.14.1
01.197(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2537;AMQ9558: T
he remote channel 'SYSTEM.ADMIN.SVRCONN' on host |
My question is, why do I only get 50 threads, should not I have gotten about 100, since MAXCHANNELS is set to default ?
Thanks |
|
Back to top |
|
 |
wmbwmq |
Posted: Tue Sep 10, 2013 1:39 pm Post subject: |
|
|
 Acolyte
Joined: 18 Jul 2011 Posts: 66
|
MQ uses some connections for internal purposes(it is close to 21 or so in V7.5). It's MQ's cut; so much like taxes
Now in your case, it is possible that there were other apps using up connections from the available pool. Other scenario is that your channel might have MAXINSTC set to 50 (this could be the more likely scenario I think as at exactly 50 you see the error). Also it could be due to incorrect handling of MQCONN.
Btw, i see SYSTEM.ADMIN.SVRCONN in your error logs and you say you are using 7.5 which no longer creates that channel means you manually created that channel? |
|
Back to top |
|
 |
Andyh |
Posted: Wed Sep 11, 2013 3:07 am Post subject: |
|
|
Master
Joined: 29 Jul 2010 Posts: 239
|
With SHARECNV(1) you will be getting a channel for the JMS connection, and a channel for the JMS session. Hence your MAXCHANNELS(100) will allow 50 JMS connection/session pairs.
Do you need a connection per thread ? If so you could either increase MAXCHANNELS or use a higher SHARECNV value.
Note that if you do choose to use a higher SHARECNV value you might like to consider using a specific channel for this application to avoid any side effects through exposing a higher SHARECNV value more widely. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Wed Sep 11, 2013 3:40 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Gideon wrote: |
I have a program that starts as many threads and connections as possible
|
Then no option or configuration setting in the MQ layer will ever be enough to avoid your app getting the error that all the available connections have been used up. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Sep 11, 2013 3:57 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
PeterPotkay wrote: |
Gideon wrote: |
I have a program that starts as many threads and connections as possible
|
Then no option or configuration setting in the MQ layer will ever be enough to avoid your app getting the error that all the available connections have been used up. |
W-O-R-D ! There is a law of diminishing returns: Just because you can start one more thread, should you? Eventually, you will constipate your system and nothing will get done, because the CPU is busy context-switching between all your threads. Why not have a runtime property that specifies max number of threads to start ? Hopefully, you will set that property to something less than 51.
Also take into account that MQCONNs on the MQ server side can leak. So over time, the total number of concurrent connections can be exhausted. Eventually these get cleaned up, but you should do extensive performance testing. With MQ 7.0, in 2010, we ran at 10,000 TPS for 8 hours no issues, then ran out of server-side connection resources and the application ground to a halt. We did some iterative code changes and testing, eventually finding a sweet-spot compromise between number of concurrent connections and performance and longevity. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|