PubSub: The delivery of a pub/sub node is very slow

Hi all,

I am a newbie to Smack, and am trying to write a jabber client which uses the XEP-0060 pub/sub extension. I use ejabberd 2.1.10 as xmpp server.

The jabber client works well but the performance is very bad. Retrieving an existing node is very slow.

I figured it out with adding some time measurements.

public void publish(Item item, String nodeName) throws XMPPException {
long start = System.currentTimeMillis();
LeafNode myNode = (LeafNode) pubSubManager.getNode(nodeName);
System.out.println(System.currentTimeMillis() - start);
myNode.publish(item);
}

Is there a reason why it takes up so much time? 450ms - 480ms? The sending throughput is about 2 messages per seconds.

Is there a workaround to minimize the time consumption?

The creation of a node:

public void createNode(String nodeName) throws XMPPException {

ConfigureForm form = new ConfigureForm(FormType.submit);

form.setPersistentItems(false);

form.setDeliverPayloads(false);

form.setNotifyRetract(true);

form.setPublishModel(PublishModel.open);

form.setAccessModel(AccessModel.open);

form.setSubscribe(true);

manager.createNode(nodeName, form);

}

Thanks in advance!

Kind regards,

Bill

You should keep a reference to your node once you get it instead of doing a get each time you want to publish, the getNode() does make a call to the server to verify that the node exists. You are in fact making 2 synchronous calls to the server in your publish method, the first of which is likely a db hit as well.