Page 3 of 3
Re: php ajax chat room will increase server load?
Posted: Sat Jul 11, 2009 1:58 am
by Benjamin
JAB Creations wrote:First and foremost headers aren't counted towards your bandwidth.
Every single packet sent is counted when computing bandwidth, regardless of the contents.
Re: php ajax chat room will increase server load?
Posted: Sat Jul 11, 2009 3:30 pm
by JAB Creations
Time to look at your Apache access logs!
Create a one byte file, download it, and then look at your log.
Re: php ajax chat room will increase server load?
Posted: Sun Jul 12, 2009 3:26 am
by arjan.top
in log you have document (content) size, not including headers etc.
Re: php ajax chat room will increase server load?
Posted: Sun Jul 12, 2009 3:38 am
by VladSun
Jab, by using the term "bandwidth", we
all mean bandwidth at OSI Layer 3 - that is Network Layer: IP, ICMP, IPsec, IGMP, etc. protocols. It's not even TCP.
HTTP is far away from this - it's in the last Layer 7, the Application Layer.
http://en.wikipedia.org/wiki/OSI_model
Re: php ajax chat room will increase server load?
Posted: Sun Jul 12, 2009 4:13 am
by JAB Creations
Well gee, there is another chunk of the world I was blissfully unaware of.

Thanks for pointing that out.
Re: php ajax chat room will increase server load?
Posted: Sun Jul 12, 2009 4:22 pm
by morris520
Right all I have done using techniques here:
http://www.zeitoun.net/articles/comet_and_php/start
So it says it is comet, a kind of server push. But,
Server do not push every 2sec
Just wondering why that example code using HTTP streaming does so? Please point me out. Are they called 'PUSH'?
Thanks for reply
Re: php ajax chat room will increase server load?
Posted: Sun Jul 12, 2009 4:59 pm
by VladSun
It uses long polling technique, it's not real "server push".
Re: php ajax chat room will increase server load?
Posted: Sun Jul 12, 2009 5:00 pm
by jackpf
That's quite clever actually...
Although in a case like that, I would have actually thought pull would be better than push, as this script has to be executing the whole time, and a connection has to be maintained constantly for all users.
But if people say it's better...who knows.
Re: php ajax chat room will increase server load?
Posted: Mon Jul 13, 2009 7:24 pm
by morris520
jackpf wrote:That's quite clever actually...
Although in a case like that, I would have actually thought pull would be better than push, as this script has to be executing the whole time, and a connection has to be maintained constantly for all users.
But if people say it's better...who knows.
jackpf,
I think the reason is pull uses more resource to build the request from client side and pull saves one step to be that much. I don't think it's possible to make do "real time", like instant messenger, or it might need a distributed server sets, like Messenger.
Usually it looks like 2-5 secs delay is acceptable but that's really depended on < 1000 users... But if this application is on the public face website, it's anther world.... God knows how many will chat at the same time
Re: php ajax chat room will increase server load?
Posted: Thu Jul 30, 2009 7:47 pm
by s.dot
I appended the chat messages by appending a child div with javascript (for the new message) to the chat display area.
So I just let them go as long as the user was in the chat room.
It never became a problem.
Re: php ajax chat room will increase server load?
Posted: Fri Jul 31, 2009 12:11 pm
by pickle
Why re-invent the wheel?
PHPFreeChat
PHPChat
Re: php ajax chat room will increase server load?
Posted: Fri Jul 31, 2009 12:16 pm
by jackpf
What's the fun in that?
Re: php ajax chat room will increase server load?
Posted: Fri Jul 31, 2009 12:38 pm
by JAB Creations
PHPFreeChat is ok but it didn't
integrate in to my site when I first tried it which is the most important aspect of third party modules...they integrate seamlessly or they prove to require too much time and energy.
I wrote a chat room from scratch this past January and then ended up rewriting it even better. There is always the possibility that when you reinvent something you could end up with something better and the invaluable experience associated with it.

Re: php ajax chat room will increase server load?
Posted: Fri Jul 31, 2009 3:07 pm
by jackpf
Yeah, high five for writing your own programs and not blindly copying scripts off the internet....
Re: php ajax chat room will increase server load?
Posted: Fri Jul 31, 2009 3:15 pm
by JAB Creations
Though there is a point to not reinventing the wheel in some regards. Let's say someone write a chat and releases it and it's better then the previous status quo. If it's easier to implement then the wheel was reinvented and more compatible with more sites...or at least increases the overall potential that any chat room is compatible or easy to implement subjective to any given site. So far nothing feels (to me at least) like it's met an acceptable standard plus I've wanted to have something that didn't clash yet was completely customizable with CSS. I guess the wheel analogy works in some ways however it's too broad when the needs of the many can't be fulfilled by too few options.