With MYSQL, PHPSimpleChat is setup to use the memory type engine.
With memory tables, the entire table is kept in memory and never
on disk. This ensures fast performance. In addition, a garbage
collection process is executed periodically to keep table size
small. PHPSimpleChat can be tuned to provide the best performance
possible for your server.
PHPSimpleChat uses AJAX callbacks to PHP scripts at preset
intervals to update the chat room. These intervals can be changed
in the config.php file. These variables are set to integers
which represent the number of seconds between each callback.
The lower the number of seconds, the faster and more responsive
the chat room is. However, this means more queries will be sent
to your database, which could adversely affect the performance
of your chat room if the database cannot handle the additional
queries. The following settings in config.php can be tuned for
performance:
PHPSC_CHAT_INTERVAL. This is the basic interval that the chat
room is updated. If you want more responsiveness, you can lower
this value to 2, but be careful not to overwhelm your database.
If you have a large number of chatters and have trouble keeping
your database up, you may want to raise this value to 6.
define('PHPSC_CHAT_INTERVAL', 4);
PHPSC_CHAT_IDLE_INTERVAL. This is the interval that a chat
room is updated for a user that is considered idle. If you have
database resources to spare, you can halve this value.
define('PHPSC_CHAT_IDLE_INTERVAL', 26);
PHPSC_IDLE_THRESHOLD. This represents the number of chat intervals
that must pass for a user to be considered idle. You can multiply
this value by the PHPSC_CHAT_INTERVAL to get the time passed
before a user is considered idle. If you have many chatters,
as database resources are low, you can lower this value to make
users go idle faster.
define('PHPSC_IDLE_THRESHOLD', 60);
PHPSC_USER_ACTIVE_INTERVAL. This is the interval that user
list is refreshed for each chat room.
define('PHPSC_USER_ACTIVE_INTERVAL', 14);
PHPSC_USER_UPDATE_INTERVAL. This is the interval that a user
is marked active for their current chat room. If your chat room's
user list is too long, you can lower this value so inactive
users are removed sooner.
define('PHPSC_USER_UPDATE_INTERVAL', 90);
PHPSC_PRIVATE_CHAT_INTERVAL. This is the interval that requests
for private chats are checked for. On a community driven site,
you may want to lower this number.
define('PHPSC_PRIVATE_CHAT_INTERVAL', 15);
The performance of PHPSimpleChat can be greatly increased by
turning on the MYSQL query cache. In hosted environments, this
is almost always turned on, and beyond your control anyways.
On your own server, distributions of MYSQL often come with the
MYSQL Query Cache turned off, so be sure to turn it on. Below
is a screenshot of test of the MYSQL Query Cache.