+

Search Tips | Advanced Search

Reducing the number of unwanted topics in the topic tree

The performance of a publish/subscribe system is improved by reducing the number of unwanted topics in the topic tree. What is an unwanted topic and how do you remove them?

We can create large numbers of topics without affecting performance adversely. However, some ways of using publish/subscribe result in continually expanding topic trees. An exceptionally large number of topics are created once and never used again. The growing number of topics might become a performance problem.

How can you avoid designs that lead to a large and growing number of unwanted topics? What can we do to help the queue manager remove unwanted topics from the topic tree?

The queue manager recognizes an unwanted topic because it has been unused for 30 minutes. The queue manager removes unused topics from the topic tree for you. The 30 minute duration can be changed by altering the queue manager attribute, TREELIFE. We can help the queue manager to remove unwanted topics by making sure that the topic appears to the queue manager to be unused. The section, What is an unused topic? explains what an unused topic is.

A programmer, designing any application, and especially designing a long running application, considers its resource usage: how much resource the program requires, are there any unbounded demands, and any resource leaks? Topics are a resource that publish/subscribe programs use. Scrutinize the use of topics just like any other resource a program uses.


What is an unused topic?

Before defining what an unused topic is, what exactly counts as a topic?

When a topic string, such as USA/Alabama/Auburn, is converted into a topic, the topic is added to the topic tree. Additional topic nodes, and their corresponding topics, are created in the tree, if necessary. The topic string USA/Alabama/Auburn is converted into a tree with three topics.

To display all the topics in the topic tree, use the runmqsc command DISPLAY TPSTATUS('#') TYPE(TOPIC).

An unused topic in the topic tree has the following properties.


Managing the number of topics in a topic tree

In summary, there are a number of ways to manage the number of topics in a topic tree.