09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

General Features of JMS<br />

backed_order topic. Specifying the retention as TRUE for the shipping queues and<br />

specifying the order number in the correlation field of the message, SQL queries can<br />

be written to determine the wait time for orders in the shipping application.<br />

For simplicity, we will only analyze orders that have already been processed. The<br />

processing time for an order in the shipping application is the difference between<br />

the enqueue time in the WS_bookedorders_topic and the enqueue time in the<br />

WS_shipped_orders_topic.<br />

SELECT SUM(SO.enq_time - BO.enq_time) / count (*) AVG_PRCS_TIME<br />

FROM WS.AQ$WS_orders_pr_mqtab BO , WS.AQ$WS_orders_mqtab SO<br />

WHERE SO.msg_state = ’PROCESSED’ and BO.msg_state = ’PROCESSED’<br />

AND SO.corr_id = BO.corr_id and SO.queue = ’WS_shippedorders_topic’;<br />

/* Average waiting time in the backed order queue: */<br />

SELECT SUM(BACK.deq_time - BACK.enq_time)/count (*) AVG_BACK_TIME<br />

FROM WS.AQ$WS_orders_mqtab BACK<br />

WHERE BACK.msg_state = ’PROCESSED’ AND BACK.queue = ’WS_backorders_topic’;<br />

Supporting <strong>Oracle</strong> Real Application Clusters in JMS<br />

<strong>Oracle</strong> Real Application Clusters can be used to improve AQ performance by<br />

allowing different queues to be managed by different instances. You do this by<br />

specifying different instance affinities (preferences) for the queue tables that store<br />

the queues. This allows queue operations (enqueue/dequeue) or topic operations<br />

(publish/subscribe) on different queues or topics to occur in parallel.<br />

The AQ queue monitor process continuously monitors the instance affinities of the<br />

queue tables. The queue monitor assigns ownership of a queue table to the specified<br />

primary instance if it is available, failing which it assigns it to the specified<br />

secondary instance.<br />

If the owner instance of a queue table terminates, the queue monitor changes<br />

ownership to a suitable instance such as the secondary instance.<br />

AQ propagation is able to make use of Real Application Clusters, although it is<br />

transparent to the user. The affinities for jobs submitted on behalf of the<br />

propagation schedules are set to the same values as that of the affinities of the<br />

respective queue tables. Thus, a job_queue_process associated with the owner<br />

instance of a queue table will be handling the propagation from queues stored in<br />

that queue table thereby minimizing pinging. Additional discussion on this topic<br />

can be found under AQ propagation scheduling (see "Scheduling a Queue<br />

Propagation"in Chapter 9, "Administrative Interface"and <strong>Oracle</strong>9i Real Application<br />

Clusters Setup and Configuration.)<br />

Creating Applications Using JMS 12-19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!