Limit Concurrent Users Y2.1Version 1.0b beta
Languages:
Dutch, English (Spikecity)
German (JetLi)
This mod sets a hard deck on the amount of concurrent users on a forum (read: simultaneous perl processes), to avoid bringing a server down due to excessive hammering on the script.
The code keeps track of the started processes by increasing a counter value in a one line file in /Variables, called concurrent.db, and decreasing this value again on exiting the script.
As soon as the value reaches the hard deck set in the Flood/Security center the script diverts to a low load exit, only displaying a message telling the forum has reached max users.
After the number of users decreases the forum comes back to original operation.
Restrictions
As the correct functioning of this code is based on a clean exit of the script it could happen that the counter does not completely reset on a script crash.
To avoid the counter from overflowing there is a small check in Board Index that resets the counter if the number of connections is higher then the number of users online.
Also in Admin Center a Clear online log will reset the connection counter to zero.
If the settings are not saved the hard deck is set to 500 concurrent connections.
The Admin Center does not allow the value to be set higher then 10000 connections (which is far beyond a DDoS attack)
The script does not take into account what a user is doing if the hard deck is reached, so it could happen that posting of a message results in the overload message and resulting in loss of the text typed.
Installation
Apply the mod, upload the changed YaBB.pl, Subs.pl, Admin.pl, Admin.lng, BoardIndex.pl
Upload Concurrent.lng in the correct language dir
Testing
Go to admin center -> Flood/Security and set the value for concurrent to -1
Now go to your forum and you should get the low load message telling you the forum has reached it's max concurrent users.
Go back to admin center and set the value anywhere between 50 and 500.
Monitor your site and if users start complaining that this error comes too often, increase the value.
Version History
1.0
First release
1.0a
- Made board index counter fix relate to $totalusers instead of $numusers (Thanks Zoo)
- Added German version (Thanks JetLi)
1.0b
- Changed inclusion of concurrent.db to a file read to avoid corruption (please delete any old concurrent.db before using this version)
Download link:
Click here