Connect and login performance

Dear All:

I integrated Smack v3.1.0 library to my Android project and Server was based on Openfire v3.6.4. While connecting and logining to openfire were slow, how do I fix that problem or some tips gave me.

Hi,

Were facing a similar problem with the connection.

Using smack to integrate with openfire with the following connect code -

ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(serverName, serverPort);
connectionConfiguration.setSASLAuthenticationEnabled(true);
SmackConfiguration.setPacketReplyTimeout(1000);
connection = new XMPPConnection(connectionConfiguration);
connection.connect();

The connect method takes over half a second to complete. This is not acceptable in terms of our required response time.

Openfire server is running on the same machine as the application server, so network problems were ruled out.

Smack ver. - 3.0.4. Openfie ver. - 3.6.2. Tried upgrading both to the latest and greatest but the issue persisted.

Any advice or suggestion will be appreciated.

Hi,

you may want to add logging statements to see where the time is spend. Can you create thread dumps (Ctrl+C or jstack(.exe)) while the connection is established? There you may see which native call causes the delay, maybe it’s an issue with /dev/random.

LG

Thanks for the reply.

I added logging and traced the problem to the packet reader startup method. It takes up most of the connection time.

Also, I removed the call to SmackConfiguration.setPacketReplyTimeout(10000), and that dramatically improved the connect time.

Any idea why? This setting was added because of user disconnects we had in the past.