ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » High(100%) CPU usage with Triggered Application

Post new topic  Reply to topic Goto page Previous  1, 2
 High(100%) CPU usage with Triggered Application « View previous topic :: View next topic » 
Author Message
zpat
PostPosted: Tue Dec 07, 2010 7:39 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Polling (yuck) and triggering are not the only options.

A long running process with an outstanding MQGET WAIT is often the best for anything relatively high volume. This is what the IBM message broker does for example for MQ input nodes.
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Tue Dec 07, 2010 7:43 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

Quote:
Whats the way to make it work if I dont want the app to get retriggered until certain interval?


These both mechanisms to trigger do not depend on each other.

if a queue is tirggered first and the (last) application closes the queue leaving it not empty and all the other trigger conditions are met, a new trigger is genereated, no matter how your trigint settings are.

there is no "trigger after time" - mechanism. you could trigger by depth 1 which is the same like trigger first, but queue is then set to "notrigger". you need a mechanism to set the queue back to "trigger". i wont do that.

whats wrong with being started again by the trigger monitor if there are messages on the queue left after 1000 have been consumed and your application terminates?

i'd also suggest to remove that "end after 1000 messages". why do you do that? what becomes for efficient by doing that? (as you said it is for efficiency) ?!?
_________________
Regards, Butcher
Back to top
View user's profile Send private message
mdfaraz
PostPosted: Tue Dec 07, 2010 8:09 am    Post subject: Reply with quote

Novice

Joined: 31 Mar 2010
Posts: 19
Location: Houston, TX

I wanted to have a mechanism to stop the app anytime while its processing messages. Even if there are still messages to be processed, I want to stop processing and exit. So I have logic in the while loop for processing messages, to look at a flag in a DB table. If its set to true, then continue processing, if its set to false, exit the while loop(and the program). What I meant by checking after 1000 is, I don't want to keep hitting the DB for this value while processing messages. but I do it every 1000 iterations. The algorithm is

Sub ProcessQueue
Connect to QMGR
Open Queue
dim b as boolean=true
Do
Try
For every 1000th iteration, Check if Enabled
If Enabled, Continue, else exit
Queue.GET()
Process message
Catch exception
b=false
While b=True
Cleanup code
End Sub

Whenever we want these apps to exit, we set this enabled flag in DB to false. so within the processing of next 1000 messages, the app exit. At this point, I want my app not to start again(atleast not instantly). I thought triggerinterval is the property that will determine when to start the app next. Looks like its not.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Dec 07, 2010 8:25 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If there are still messages on the queue, you will get retriggered.

If you want to halt triggering, your program can alter the properties of the queue to stop the trigger message from being generated.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Dec 07, 2010 9:06 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mdfaraz wrote:
I thought triggerinterval is the property that will determine when to start the app next. Looks like its not.


No, it's not.

If you want to stop this application then whatever mechanism used to set or unset this flag on the database table must be modified to switch triggering on or off.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Dec 07, 2010 9:06 am    Post subject: Re: Miracle! Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mdfaraz wrote:
I just cudn't believe how following best practices affected the performance by 2000%!


They're called "best" for a reason.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Tue Dec 07, 2010 11:39 pm    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

as already been written, setting the db flag to make your program exit is not enough. your program will terminate, but will be re-triggered by mq immediately if the queue is left non-empty.

i would the get-enable / disable attribute of the queue for that.

in the program, catch the proper returncode and exit if the queue is get-disabled (dont forget do commit everything else before that has been completed).

get-disable will also prevent mq from creating a new trigger, as one of the trigger conditions is that the queue must be get-enabled.

if you get-enable the queue again (and all the other tirgger conditions are met), a new trigger is created automatically and your program is started again.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » High(100%) CPU usage with Triggered Application
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.