jQuery PHP MySQL Chat Doubts

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
G l a z z
Forum Newbie
Posts: 24
Joined: Sun Feb 12, 2012 10:33 pm

jQuery PHP MySQL Chat Doubts

Post by G l a z z »

Hi there,

I'm creating a live chat script, something like Zopim, and for now the way i retrieve messages is using jQuery Ajax request loops every 'n' second, it works very good, but yeah, when we look at the apache access log we get tons of messages from the script, is this a bad thing ?

I know how to do long polling request, but i don't like this method, although it is effective, it is defective lol, sometimes it crashes apache, and it creates a process for every user that is using the chat, so i'm not going to use this method.

Another one is using services like Pusher.com for use HTML5 WebSockets, i'm testing this and i really like it, but if the Pusher website goes down the script itself doesn't work...


What do you guys recommend me to do, since this script is to be selled.
User avatar
Weiry
Forum Contributor
Posts: 323
Joined: Wed Sep 09, 2009 5:55 am
Location: Australia

Re: jQuery PHP MySQL Chat Doubts

Post by Weiry »

Well I would hazard a guess that the majority of SIMPLE chat services are going to be based via PHP, AJAX and MySQL.

Alternatives would be an actual chat 'server' which either deals through sockets or software that is designed as a chat protocol such as XMPP.

It really depends how much this intends on being used, because if it supposed to be used quite a considerable amount, then you may actually be better off using something that is dedicated rather than a script that gets called every second for every chat window that is running.
Admittedly, MySQL can handle that load, however depending on the resources your web server itself has, you could find it running under more load than it probably should be.

It really comes down to whether your underestimating or overestimating the usage of the system.
Post Reply