powered by Jive Software

How to load test Openfire with Clustering?

Once you have installed Openfire Enterprise 3.4.0 and clustering is enabled you are ready to load test the server. Load testing a server means that we are going to simulate thousands of users connecting to the server and generating a lot of traffic to the server.

The first step of a load test is to define the goals that you want to achieve. That means that you will need to know how many concurrent users you will have in your installation, the traffic that they will generate and the expected response time. More precisely, you have to figure out frequency users will change their presences, send messages, ask vCards or join rooms. Once you have defined your expected load and expected results you are ready for the next step which is Create User Accounts.

To create user accounts you need to start Openfire in a single node, install the plugin and follow these steps:

  1. Log into the Admin Console and go to Users/Groups -> Users Creation

  2. Specify a User prefix for example “usr”. In this example, the script will generate accounts of the form: usr0, usr1, usr2, usr3, etc.

  3. Specify the number of users to create and the amount of contacts in roster.

  4. Let the script run. The script will run in background and it will print in the stdout the progress of the user creation. Note that creating hundreds of thousands of users may take some hours.

Finally, you need to setup the the load clients. Follow these steps:

  1. Define how many linux machines you are going to use. Note that each linux machine may simulate 60K concurrent users. If you are using many network interfaces it’s possible to generate 60K per network interface. You might need to fine tune your linux box to be able to generate 60K connections.

  2. For each machine that will run the load test script you will need to:

  3. Create a folder and download , , , and . Unzip on your working directory

  4. Edit the OpenfireClusterStressTest.xml file

  5. Set amount of users to simulate. All load clients should use the same amount

  6. Set the user prefix to use. This value should match the one used in the userCreation plugin. In our example we used: “usr”

  7. Set startUser to define range of user accounts to use. For example if it is set to 100, the first user to login is usr100, then usr101 and so on. Make sure that each node is using a different range of accounts.

  8. cluster.node: Specify the IP address of hostname of each cluster node that is part of the cluster. Create a new node in the XML file for each cluster node

  9. Make sure that server matches the XMPP domain being used by Openfire. You can get this value from the main page in the admin console.

Execution
  1. Startup the openfire cluster (this includes your cluster nodes)

  2. Run startup.bat for Windows or startup.sh for Linux in each load client

  3. The stress test progress can be seen in the file clustertest.log and also in the openfire console admin

  4. Once all users have logged in the stress test will continue generating traffic until you stop it. Hit any key to stop the load test script.

Problems or questions should be posted to the discussion forums.

1 Like

what version of java do I need for OpenfireClusterStressTest.jar ?

$JAVA_HOME/bin/java -version

java version “1.5.0_06”

Java™ 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)

Java HotSpot™ Server VM (build 1.5.0_06-b05, mixed mode)

$JAVA_HOME/bin/java -classpath OpenfireClusterStressTest.jar:xpp.jar OpenfireClusterStressTest

Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:620)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)

at java.net.URLClassLoader.access$100(URLClassLoader.java:56)

at java.net.URLClassLoader$1.run(URLClassLoader.java:195)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)

at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Hey blueconsole,

The jar file was probably compiled with Java 6 (without using compatibility with Java 5). We are going to upload a new version in a moment. Anyway, I would recommend running both the server and the load clients with Java 6 to get the best performance in each of them.

– Gato

Hi, the attached OpenfireClusterStressTest.zip file contains the classes compiled using Java 5 and it must be unzipped on your working directory. The startup files were also modified.

Thanks,

Francisco

Note that I installed a usercreation plugin only on one node.

I actived the 1st node (i.e. hwa2004) and then activate the 2nd node (i.e. hwa2005)

I used gaim to loging as usr0 and usr1 and it all works(passing IM etc)

I notice that in Admin Console on hwa2004:

“Server Name: hwa2004.azulsystems.com

but in the server-properties I see:

xmpp.domain hwa2005.azulsystems.com

What should the OpenfireClusterStressTest.xml contain for the server?

With the new files I get:

$JAVA_HOME/bin/java -classpath xpp.jar:. OpenfireClusterStressTest

Exception in thread “main” java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParser

with the old files and using java 1.6:

$JAVA_HOME/bin/java -version

java version “1.6.0”

Java™ SE Runtime Environment (build 1.6.0-b105)

Java HotSpot™ Server VM (build 1.6.0-b105, mixed mode)

$JAVA_HOME/bin/java -classpath OpenfireClusterStressTest.jar:xpp.jar OpenfireClusterStressTest

java.net.ConnectException: Connection refused

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

at java.net.Socket.connect(Socket.java:519)

at java.net.Socket.connect(Socket.java:469)

at java.net.Socket.(Socket.java:179)

at OpenfireClusterStressTest.testMultipleLogin(OpenfireClusterStressTest.java:111)

at OpenfireClusterStressTest.main(OpenfireClusterStressTest.java:46)

Hey blueconsole,

What should the OpenfireClusterStressTest.xml contain for the server?

It should include server domain: hwa2005.azulsystems.com. For example:

hwa2005.azulsystems.com

hwa2004.azulsystems.com

Exception in thread “main” java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParser

May be it is because the file xpp.jar is not downloaded in your working directory

java.net.ConnectException: Connection refused

This is because the client could not connect to the server node to the port 5222. Try changing the server name in

Notice that a good test to verify connectivity between client and servers is to execute from the client command line:

OpenfireClusterStressTest.xml is not being read!

the OpenfireClusterStressTest defaults to run on localhost and user1 to whatever specified in the source code.

so I logged into hwa2005 and run the test from there.

Have you run your test from a machine other than the one that runs the server?

public OpenfireClusterStressTest()

{

server = “localhost”;

port = 5222;

usernameprefix = “user”;

amountOfUsers = 4;

startUser = 1;

delayTime = 30;

outputFilename = “clustertest.log”;

Hi,

The OpenfireClusterStressTest class reads the xml. Please try using the classes instead of the jar and verify the xml file is in your working directory.

Let me know if it works.

Regards,

Francisco

bingo

it works:

$JAVA_HOME/bin/java -classpath xpp.jar:. OpenfireClusterStressTest

When I run it, I get:

java -classpath xpp.jar:. OpenfireClusterStressTest

java.net.SocketException: Broken pipe

at java.net.SocketOutputStream.socketWrite0(Native Method)

at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)

at java.net.SocketOutputStream.write(SocketOutputStream.java:124)

at OpenfireClusterStressTest.send(OpenfireClusterStressTest.java:401)

at OpenfireClusterStressTest.testMultipleLogin(OpenfireClusterStressTest.java:133)

at OpenfireClusterStressTest.main(OpenfireClusterStressTest.java:46)

My java version:

$ java -version

java version “1.6.0_02”

Java™ SE Runtime Environment (build 1.6.0_02-b05)

Java HotSpot™ Server VM (build 1.6.0_02-b05, mixed mode)

I’d appreciate any insight that you can give. Thanks!

Mick

How many users? (i.e. amountOfUsers)

do you get the message with under 10 users?

Thanks for the reply blueconsole. My config looks like this:

Just to add, “User Summary” has 4 users at the moment – I’m not sure if that is what you meant.

I think you are running out of descriptors.

try reducing the 60000 to 6, to see if it works.

if you are on linux use “limit” command to see what is the max. number of descriptors you have.

Well it never gets to start (to clarify). I did change it to “6” (same problem).

Also, this is what I currently have:

$ cat /proc/sys/fs/file-max

205586

ulimit says it is unlimited

Don’t think it has to do w/ that (since it never gets to even start).

Mick

Hi Mick, could you check:

  • The config file is: OpenfireClusterStressTest.xml

  • File OpenfireClusterStressTest.xml is located in the same directory as the OpenfireClusterStressTest.class

  • Verify that the client host can connect to the target server and port 5522.

Thanks,

Francisco

Hi Francisco,

thanks for the reply. i do have the config file there and it has the correct name. The last comment isn’t working as expected. It isn’t connecting on 5522.

netcat shows: 5522 (?) : Connection refused

I thought that it is supposed to be listening on 5222 anyway (or?). 5222 is open.

I think that if I show how my setup works - it might make more sense (as I may be doing something wrong).

connection managers are RR DNS’ed w/ ccm.xmpp.example.com while the cluster nodes are RR DNS’ed w/ cluster.xmpp.example.com – the “server name” is set in openfire as “ccm.xmpp.example.com

Currently I can connect to the servers (all nodes) and I see that the connection managers are connecting just fine. When I changed the (i guess it connects to openfire on that port). cluster.xmpp.example.com does have that port open.

The only other DNS related thing that I have (missing) is a reverse DNS entry for each of the cluster nodes & connection managers. I don’t think that that would cause any problems though.

Thanks again for your response,

  • Mick

Hey,

Sorry, the correct port is 5222 as you said. Were you able to connect to the Openfire cluster using Spark?

Try using:

  1. Username: user1

  2. Password: user1

  3. Server: ccm.xmpp.example.com

  4. Advanced -> Uncheck “Automatically discover host and port”, and fill in Host: 192.168.2.1

  5. Then Login

Please, check if you succeed using 192.168.2.1 and 192.168.2.2.

When you run the load test script, does it generates the file clustertest.log? It would indicate if it delivered some package.

At last, are you using the attached ?

Hi!

I am having problems using the stress program.

The messages it tries to send are of the type:

java.lang.Exception: Failed to create connection to remote server

The xml file is being read (since it logs every user), it’s just this problem with the messages.

BTW, would it be possible to get the source of the stresstest? I don’t think it has any ultra-secret-important code

Thanks a lot for Openfire!!

Hey Guys,

Should all these methods work with the latest version 3.4.5? Just im having trouble with presence subscriptions and the userCreation.jar not wanting to create users for me.

best

Mark