Increase the maximum number of openfire connections
There are three elements that affect the number of connections:
1) Linux System Parameters
2) Number of threads that can be created by the process itself
3) openfire System Parameters
Linux System Parameters
1. ulimit-N 265535
On the Linux platform, whether it is a client program or a server program, during high-concurrency TCP connection processing, the maximum number of concurrent connections is limited by the number of files that the system can open for a single process (this is because the system creates a socket handle for each TCP connection, each socket handle is also a file handle), which can be larger.
This command is temporary, or you can modify the file/etc/security/limits. conf
2. net. ipv4.ip _ conntrack_max = 265535
The maximum number of trace connection entries allowed by the system. Add this attribute to the/etc/sysctl. conf file and run>/sbin/sysctl. conf-P
In addition, when sysctl-P is used, a Reports error: 'Net. ipv4.ip _ conntrack_max 'is an unknown key. Run the following command to correct the error:
Modprobe ip_conntrack
Echo "modprobe ip_conntrack">/etc/rc. Local
3. fs. File-max = 265535
Number of file handles that can be opened at the system level. ulimit is process-level.
4. kernel. threads-max= 265535
Maximum number of threads that the system can generate
5. VM. max_map_count = 265535
Defines the maximum memory area that a process can have.
6. Other parameters can be set as follows:
Net. ipv4.conf. Default. rp_filter = 1
Net. ipv4.conf. Default. accept_source_route = 0
Kernel. sysrq = 0
Kernel. core_uses_pid = 1
Net. ipv4.tcp _ syncookies = 0
Kernel. msgmnb = 265536
Kernel. msgmax = 265536
Kernel. shmmax = 68719476736
Kernel. Shmall = 4294967296
Net. ipv4.tcp _ max_tw_buckets = 6000
Net. ipv4.tcp _ sack = 0
Net. ipv4.tcp _ window_scaling = 1
Net. ipv4.tcp _ rmem = 4096 87380 4194304
Net. ipv4.tcp _ WMEM = 4096 16384 4194304
Net. Core. wmem_default = 8388608
Net. Core. rmem_default = 8388608
Net. Core. rmem_max = 16777216
Net. Core. wmem_max = 16777216
Net. Core. netdev_max_backlog = 262144
Net. Core. somaxconn = 262144
Net. ipv4.tcp _ max_orphans = 3276800
Net. ipv4.tcp _ max_syn_backlog = 262144
Net. ipv4.tcp _ timestamps = 0
Net. ipv4.tcp _ synack_retries = 2
Net. ipv4.tcp _ syn_retries = 2
Net. ipv4.tcp _ syn_retries = 1
Net. ipv4.tcp _ tw_recycle = 1
Net. ipv4.tcp _ tw_reuse = 1
Net. ipv4.tcp _ mem = 94500000 915000000 927000000
Net. ipv4.tcp _ fin_timeout = 1
Net. ipv4.tcp _ keepalive_time = 1200
Net. ipv4.ip _ local_port_range = 1024 60000
Net. ipv4.tcp _ window_scaling = 0
Net. ipv4.tcp _ no_metrics_save = 1
JVM Parameters
The maximum number of threads that can be generated in JVM is affected by the JVM heap memory size, thread stack memory size, and the maximum number of threads that can be created in the system:
(Maxprocessmemory-jvmmemory-reservedosmemory)/(threadstacksize) = number of threads
Maxprocessmemory refers to the maximum memory of a process.
Jvmmemory JVM memory
Operating system memory retained by reservedosmemory
Threadstacksize the size of the thread Stack
Openfire system attributes
Cache. username2roster. Size: 12000000
Cache. Group. Size: 40000000
Cache. usercache. Size: 35000000
Cache. lastactivity. Size: 1500000
Cache. offlinepresence. Size: 1500000
Note: I have not actually tested
Increase the maximum number of openfire connections