powered by Jive Software

Smack can't get presences

Hi,

I’m now load testing on an openfire server with a client program I made by myself. The problem is that some client thread can’t get presences of users in a roster when thousands of client thread are generated. The client is based on smack library.

Environment:

  1. Assume that one group (logical group) has 100 users. Each user has 99 users who are the rest of this group on her roster. Therefore there are 9900 roster entries for one group in openfire db.

  2. 100 groups were registered in openfire server. Therefore, in total 10,000 user acounts and 990,000 roster entries are served by an openfire server.

Test Scenario:

  1. Generate client threads each of which represents a user in the order of groups. It menas that test program generates 100 users that belong to the frist group, and the next 100 users in the second group and so on. Therefore, each user in a specific group should get all available presences of the rest of the group just in a short time after she logs in.

  2. Each thread logs in to openfire server with given user account, get the roster, and wait until getting all availabe presences in the roster. Once getting all presences, disconnects in 10 secs.

  3. Threads are generated in every 50ms, so 120 requests per second are sent to the server.

When I tested just on 10 users with the scenario above, one or two users can’t get other users’ presences. Sometimes it gets no presence at all, otherwise it gets one, two, or eight presences. The expected result is that it gets nine presences…

Openfre server audit log tells me that it sent all presence packets to the clients. However, the client threads can’t get them even though they are waiting for two or three minutes. I’m wondering where these presence packets are going to.

Please let me know where I have to look into… My client program code are as below.

Thanks in advance.


XMPPConnection connection;

SmackConfiguration.setPacketReplyTimeout(10000);

// Configure the connection

ConnectionConfiguration config = new ConnectionConfiguration( testConfig.getServerName(), testConfig.getServerPort(), testConfig.getServerServiceName());

config.setSendPresence(true);

config.setSASLAuthenticationEnabled(true);

connection = new XMPPConnection(config);

connection.connect();

// Register packet listener

PacketListener listener = new PacketListener() {

@Override

public void processPacket(Packet packet) {

if (packet instanceof Presence) {

// When a presence packet comes in, increment received presences counter.

processPresence((Presence) packet);

return;

}

};

this.connection.addPacketListener(listener, null);

connection.login(username, password);

roster = connection.getRoster();

roster.reload();

for (RosterEntry entry : roster.getEntries()) {

String user = entry.getUser();

Presence presence = roster.getPresence(user);

Presence.Type type = presence.getType();

if (type == Presence.Type.available) {

// if there are already availabe presences in a roster, increnet presences counter

}

}

// Wait unitl all available presences received and disconnect.

I figured out that this problem is not related to Smack. I traced network packets and realized Openfire server didn’t send presence packets. I need to dig into this.