Q:

How to increase Openfire concurrent connection limit? 

I am trying to test how many concurrent user connections Openfire can handle.  I have noticed a limit at 4000 users.  How can I handle 50000 concurrent connections or more on Openfire?  What configuration should be done to handle large number of connections. 
My Server Config
OS - Ubuntu Server 14.04.1 64 bit
Processor - 3.00 GHz
RAM - 512 MB
Openfire Version - 3.9.3

For testing purpose, I am using a virtual server setup on virtualbox. 
Scenario
I'm testing Openfire 3.9.3 without connection manager and with no SSL either (yet).  The server is a virtual machine setup on Virtualbox having 3.00GHz processor and 512MB RAM.  It is a standard Openfire install with MySQL database connection with 100 maximum connections. 
When testing with a load testing script from https://community.igniterealtime.org/docs/DOC-1232 [Please note I have not setup a cluster] the number of user connection increase steadily till 4000 concurrent user connections.  Once 4000 users are connected, all connections begin to drop until all connections are lost and I get an error as follows:
java.net. SocketException: Too many open files
at java.net. Socket.createImpl(Socket.java:460)
at java.net. Socket.<init>(Socket.java:431)
at java.net. Socket.<init>(Socket.java:211)
at OpenfireClusterStressTest.testMultipleLogin(OpenfireClusterStressTest.java:111)
at OpenfireClusterStressTest.main(OpenfireClusterStressTest.java:46)

Issue
Cannot handle more than 4000 concurrent user connections.  How to increase this limit? 
What openfire configuration is required to achieve the same? 

A:

You are not hitting an limit imposed by Openfire.  Unix-like systems limit the maximum number of open file handles, and this includes (TCP) sockets, a process can have.  You need to set a higher limit (it appears to be currently set to  something around 4000).  The limit is usually modified with the ulimit command. 
See also:

https://unix.stackexchange.com/questions/85457/how-to-circumvent-too-many-open-files-in-debian
https://unix.stackexchange.com/questions/169004/number-of-open-files-configuration-not-operational

A:

Adding to @Flow's answer...
If you are trying to connect from another computer, then you would have to increase the ulimit of that computer too. 
The mistake
I had raised the limit of maximum number of open files. 
But, I was trying to connect from another computer and the ulimit for the same was set to default. 
Hence, the test would fail on reaching 4000 connections. 
Solution that worked for me
When I updated the ulimit of the computer that runs the test script, it worked fine. 
I am now able to achieve 20000 concurrent connections.