In this article we’ll discuss why in some cases running chat software on your hosting account might lead to problems. Typically on a dedicated server, chat software would be fine, but on a VPS or shared hosting server the overhead required to run them can cause issues.
The way that most chat software operates is by storing data in a MySQL database, or a file based database. Then for every visitor that is in the chat room, it will typically poll the server as frequently as every second to check for new messages. While it might seem like a chat room doesn’t take much to run, this can be a bit misleading.
Lots of frequent requests can make hosting chat software intensive
As an example let’s say you have a chat room setup on your website and there are 10 visitors active in it. In most cases that would be 1 request per second for each user, so about 600 requests a minute. Over the course of an hour that would be about 36,000 requests the server has to handle, and around 864,000 for a whole day.
600 requests / minute
36,000 requests / hour
864,000 requests / day
Now if each of those requests was simply trying to pull up an HTML page, or some static content, a VPS or shared server could potentially host that without a problem.
However for chat software each of these requests would more than likely go to a PHP script, which is a server-side script that has to run on the server. While that PHP script executes to pull in data from the database it requires CPU usage from the server as well as disk access as the database is read.
This is the same way that most CMS (Content Management Systems) such as WordPress operate. However with a CMS you typically have only a few requests per minute and not up in the hundreds of requests happening.
Embed chat software on your website to offload intensive activity
There are many 3rd party chat providers available on the Internet where their sole purpose is to host chat rooms. Since our servers are multi-purpose and are configured to deal with a mix of website, e-mail, and database requests, when there are tons of small chat requests thrown into the mix this can lead to problems for other users sharing the server.
You can look for a hosted chat provider that will allow you to directly embed their chat client onto your website. Doing it this way our server hosting your website would only have to handle the actual HTML for the chat room.
This HTML code would be setup so that all chat requests are going directly to the chat server you’re using instead of to the local web server. That would help ensure that even if you have a room full of people chatting on your website you are not overloading a VPS or shared hosting server with all of the frequent chat requests.
Scale back usage or upgrade to dedicated server
If for some reason you can’t use 3rd party chat software that you can embed into your website, and you’ve been notified of chat software causing problems on either your VPS or shared server. You would need to either scale back the usage greatly of your chat software or upgrade to a dedicated server that can handle the extra intensive activity.