powered by Jive Software

Faster keep alive manager

I was trying to use smack in a client for load testing Openfire. When opening 2,000 connections, the client would choke on keep alive manager synchronization (some static synchronized methods). I went on, made a few changes and voila!, I’m now at 3,000 users and could probably go even higher. I don’t have a svn checkout (downloaded the source archive), so I can’t create a patch right now, so I’m attaching the whole file instead.

It’s not a big deal, I realize smack isn’t meant for highly concurrent usage, but if it can be easily improved, why not? Right?
KeepAliveManager.java.zip (3122 Bytes)

Thanks for given back your changes to the community. :slight_smile:

Hey, the community gave me Smack first. It’s the least I could do. :wink:

1 Like

I love Open Source

It would be great to have it as unified diff, though. This makes it easier to reason about your changes and merge them into the source code repository. But of course, I am able to create the diff. Just as a hint for others who want to submit patches: We prefer them as unified diffs over full files.

I had a coworker create this: http://issues.igniterealtime.org/browse/SMACK-449

I wouldn’t have dreamt of submitting anything else but a diff if it weren’t just one small file to change. I will submit a diff, but it will take a while since I’m caught up in all sorts of stuff. In the meantime, I’ve just submitted what I have so that I don’t forget about it completely.

Can you provide a version which doesn`t alter the line length? That file is saved with a shorter line length than the original so it changes much more of the file than necessary. Makes it harder to see the actual diff.

By the way, did you think of trying to increase the threadpool. It only contains a single thread for doing all keepalives, using more threads would probably make it scale better. Worth testing out at least.

The pool size doesn’t seem to be an issue. Until I get to logout, everything works fine. When doing the disconnects, almost everything got stuck on that static lock. Increasing the pool size could be beficial in heavier loads, though.

Attached reformatted version. Somehow, I only had the line length for code set at 120, the comments were left at 80.

Message was edited by: Alex Mateescu
KeepAliveManager.java.zip (3122 Bytes)