Author |
Message
|
lcl3977 |
Posted: Fri May 07, 2010 12:25 am Post subject: how many message flow instance is running currently. |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
hi all,
As we know, we can configure the message flow addtional instance in the bar file.
then we deploy it to the execute group.
can I get the number of the running instance of this message flow currently?
is there some command or function in esql can do that?
thanks. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 07, 2010 2:27 am Post subject: Re: how many message flow instance is running currently. |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
lcl3977 wrote: |
hi all,
As we know, we can configure the message flow addtional instance in the bar file.
then we deploy it to the execute group.
can I get the number of the running instance of this message flow currently?
is there some command or function in esql can do that?
thanks. |
The flowstats should tell you.
Alternatively and if nothing else has the queue open for input you could look at the queue's input count.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Esa |
Posted: Fri May 07, 2010 4:15 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Hello lcl3977,
If I understood correctly, you would like to know the number of currently running threads so that you could adjust the behavior of your flow in runtime?
As far as I know there is no way to get that information from the broker. You will have to implement a counter yourself. I would do it this way:
1. Create a singleton java class for maintaining a thread counter. You will also have to synchronize the (static) methods that update the counter.
2. Add a java compute node in the beginning of the flow. In the evaluate method do like this:
Code: |
try {
- increment the thread counter
- propagate the message
} finally {
- decrement the thread counter
}
|
Now, in the actual flow, you can access the counter and get the number of currently running threads.
Of course the counter does not always tell the precise number of threads. Threads that have caught an exception and are still processing the catch path are not counted in. Well, you can put the same JCN in the beginning of the catch path as well. There is no way to know if there are threads that are currently processing messages in the input node, but you will get a good enough approximation, I think. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri May 07, 2010 4:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Please do not make any use of this information in your message flow logic.
You will entirely tie yourself in knots and end up with a confused and unmaintainable solution.
Please explain the business requirement you are attempting to meet with this technical question. |
|
Back to top |
|
 |
Esa |
Posted: Fri May 07, 2010 5:00 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
mqjeff wrote: |
Please do not make any use of this information in your message flow logic.
You will entirely tie yourself in knots and end up with a confused and unmaintainable solution.
|
Yes, writing a flow that depends on knowing the number of currently running threads does not sound like a good idea. But I think this person is planning to put the information in an exception message...
But that won't tie anybody in knots and make them end up with a confused and unmaintainable solution. Unless you mean my way of using java will do it, which I hope you don't.
Best Regards,
Esa |
|
Back to top |
|
 |
mqjeff |
Posted: Fri May 07, 2010 5:27 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Esa wrote: |
mqjeff wrote: |
Please do not make any use of this information in your message flow logic.
You will entirely tie yourself in knots and end up with a confused and unmaintainable solution.
|
Yes, writing a flow that depends on knowing the number of currently running threads does not sound like a good idea. But I think this person is planning to put the information in an exception message.... |
There's nothing to indicate that from here. Perhaps you know otherwise.
Esa wrote: |
But that won't tie anybody in knots and make them end up with a confused and unmaintainable solution. Unless you mean my way of using java will do it, which I hope you don't. |
No, doing it with a Java singleton is fine. But doing it in general is not a great idea. |
|
Back to top |
|
 |
Esa |
Posted: Fri May 07, 2010 5:52 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
mqjeff wrote: |
There's nothing to indicate that from here. Perhaps you know otherwise.
|
No, I'm just guessing. The only reason i can think why anyone would like to do this is to try to track if certain exceptions only happen when there are several instances running simultaneously. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 07, 2010 6:12 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Esa wrote: |
mqjeff wrote: |
There's nothing to indicate that from here. Perhaps you know otherwise.
|
No, I'm just guessing. The only reason i can think why anyone would like to do this is to try to track if certain exceptions only happen when there are several instances running simultaneously. |
If that were the case it would point to a design error for not taking into account concurrency problems, would it not?
This should be relatively easy to spot without having to go counting the flow instances while in error handling...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Esa |
Posted: Fri May 07, 2010 10:53 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
Yes, if it is about a design problem. Could be something else, too. A problem with some external resource. Or a way for the developers to prove that there is nothing wrong with the design but the production environment is not correctly configured
lcl3977 has not come back so we cannot know why he wanted to know this or if this was what he wanted to know. Maybe he just wanted to know the number of the current thread... |
|
Back to top |
|
 |
lcl3977 |
Posted: Tue May 11, 2010 12:54 am Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
thank all for your reply.
let me tell you about our program and problem.
my message flow has two ways input,the http input and mq input node.
when a lot of request come in,and the message flow process the message is too slow(because other system give response to my message flow is too slow).
and then the http request will time out.
the message flow instance is 200,and in that time,I find the http connect is about 150,
so I want to know how many instance is running that time. |
|
Back to top |
|
 |
lcl3977 |
Posted: Tue May 11, 2010 1:02 am Post subject: Re: how many message flow instance is running currently. |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
fjb_saper wrote: |
Alternatively and if nothing else has the queue open for input you could look at the queue's input count.  |
in my message flow there is not only mq input node but also http input node.
and I have done a test, when the message flow don't process the message,the queue's input count does not decrease.
thank you for your reply. |
|
Back to top |
|
 |
fatherjack |
Posted: Tue May 11, 2010 1:05 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
lcl3977 wrote: |
so I want to know how many instance is running that time. |
Do you mean how many instances are running because that will be whatever you specified when you deployed won't it? Or do you mean how many are actively processing a message at any given time? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
lcl3977 |
Posted: Tue May 11, 2010 1:14 am Post subject: |
|
|
Apprentice
Joined: 04 Jul 2006 Posts: 27
|
fatherjack wrote: |
lcl3977 wrote: |
so I want to know how many instance is running that time. |
Do you mean how many instances are running because that will be whatever you specified when you deployed won't it? Or do you mean how many are actively processing a message at any given time? |
I want to know how many instances are actively processing message at any given time. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 11, 2010 2:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can get this information from the Broker administrative tooling - the CMP API, the Toolkit, the Broker Explorer and etc.
YOU DO NOT WANT TO USE THIS INFORMATION IN YOUR FLOW.
Broker 6.1 and later will let you determine the specific number of additional instances that a given node can have - not just the entire flow. This will allow you to configure the HTTPInput node to have 200 threads (for example) and the MQInput node to have 200 threads, independently of each other. If you just put the additional instances of the flow to 400, then either input node could use all threads and leave the other one without any. |
|
Back to top |
|
 |
fatherjack |
Posted: Tue May 11, 2010 2:52 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
mqjeff wrote: |
You can get this information from ..... the Toolkit |
How? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
|