Any way to share XMPPConnection between users?

I’m writing an XMPP server testing client, and in doing so I’m simulating thousands of users.

I was wondering if there’s any way to share an XMPPConnection object between many logged-in users in Smack, or if I simply have to create one per “user”.

  • Tim

Hi,

I don’t think there is anyway to do this with Smack. When Jive needed something similar to integrate their Clearspace product with Openfire, I believe they created an Openfire component or plugin that allowed them to do what you want. So you might try to find out more about how that was accomplished in the Openfire or Clearspace developer forum.

Chris

Hey Tim,

When we were simulating thousand of users we used Smack and we were opening a new socket connection per client. If you do not do that then you are not recreating a real test case. Having thousands of socket connections is not an easy task to handle by the OS so make sure you are simulating something real.

– Gato

Thanks Chris, I’ll take a look at that!

  • Tim

Yeah, I’m already hitting a lot of barriers. Current problem is the “java.lang.OutOfMemoryError: unable to create new native thread” error; I’m trying to work out how to maximize the space I’m reserving for threads.

If I had more C++ experience (I only know C, and only at an old Unix style level), then I’d write it in that instead and perhaps have something more efficient. But Java it is for this project.

  • Tim

Hi,

I’m currenty evaluating the smack API and want to build a testclient with several thousand users as well. Don’t worry about my clients - I have quite a nice pool I can use.

But my question is a little bit different. Does the smack API really make a new connection for each user? Means for each time I call connect?

Or do all users from one process share the same connection?

Because I have made a small scenario where 30 Threads open connections, do registrations and logins and I get socket closed exceptions when they are all doing this at the same time.

To have a real test for the server I need a connection for every user because otherwise I never get the server to 100% .

Hopefully someone has more insight to smack as I have right now.

  • Michael

You just have to run ‘netstat -a’ when running your test client to see all the open sockets.

I have found that, yes, Smack opens one connection per open XMPPConnection object, which

is used by each user to login.

Also, Smack creates 4 threads per user for I/O and event handling, it seems.

  • Tim