Wednesday, April 4, 2012

Why CometChat Improves Performance?

Every now and then we get a client in support whose hosting account has been suspended for 'abuse'. The typical case is that the client was in a shared hosting package with more traffic than it could handle, and the real killer is often the default IM that comes with Phpfox. This does not necessarily mean that the default IM is poorly coded and here's why: When a user sends a message via the default IM this message uses an ajax connection and connects to the web server (which in 100% of the cases we've had with this problem is Apache), the web server loads the PHP engine, the PHP engine loads the Phpfox libraries and Phpfox connects to the database and stores the message in the database, which could be as short as one word ("Yes") or even less. A user can send almost one message per second (depends on typing speed) and in these (un)lucky cases that can mean the entire routine all over again for each and every message sent.
At the same time, every client that is connected to your IM is listening for messages, this process means that the client (web browser) opens an ajax connection, this reaches the web server (again, usually Apache), this loads the PHP engine which then loads the Phpfox libraries and it checks for new messages, so far its only a second, but if there are no new messages or no new users online, it simply waits, checks the database 5 seconds later and if nothing new still, it waits... and so on for like 30 seconds, during this time the connection to the server was open, PHP and Phpfox loaded in memory and database being queried constantly, for every client that is connected. Share hosting plans limit the amount of connections open and with good reason, they have to enforce the "good neighbor" policy, but this means one single site cannot support a certain number of connections open at the same time.

Frankly, CometChat has a lot of cool features, but what really boosts performance in the client's server is the CometService, it literally takes the load off the server. Make no mistake, if you do not get CometService you will still get a better IM than the default one, but it will query your server constantly and the benefits will be limited. The CometService adds true Comet technology, meaning it is the server who contacts the client (web browser) when there is anything new.  And it is not even the client's server who takes the load, its CometChat's server.

If you are a Phpfoxer and your server is suffering from the default IM's load, do not blame the IM, blame the architecture, it was built before Comet technology existed, and give CometService a try, it costs $9/month.

2 comments:

  1. nice article thanks a lot :) ,,i'd like to invite you to write on my website if you are interested,,,i got some traffic and i would like to have you writing your interesting topics on my site blog if you dont mind ,,you can add your own google adsense in each article you write,,i have no problem at all , i just want some active bloggers on my site ,,thanks and i'll be looking forward to you hear from you
    much love and respect

    ReplyDelete
  2. hello i got your message on google plus for some unknown reason i cant leave a comment,,so here's you go for your question
    << +Tarekitsme Tarek Hi! do you have any topic in mind?
    All the best!

    - Purefan <<

    there's too many topics i got on my mind like comparing Joomla with Drupal by adding your personal point of view ,,,talking about different deal and prices of hosting a website ,,and more ,,my site is here
    www.yovibe.com
    the blog is here www.yovibe.com/blogs
    i am really in need of some excellent bloggers like you,i'll publish your articles on different groups on facebook to get you a good traffic and you can paste your google adsense under your articles so you can get a nice revenue in return ,sounds simple,clear and legal,,looking forward to hear from you :)
    Best Regard

    ReplyDelete