php ajax chat room will increase server load?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: php ajax chat room will increase server load?

Post 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.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: php ajax chat room will increase server load?

Post by JAB Creations »

Time to look at your Apache access logs!

Create a one byte file, download it, and then look at your log.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: php ajax chat room will increase server load?

Post by arjan.top »

in log you have document (content) size, not including headers etc.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: php ajax chat room will increase server load?

Post 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
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: php ajax chat room will increase server load?

Post by JAB Creations »

Well gee, there is another chunk of the world I was blissfully unaware of. :lol: Thanks for pointing that out.
User avatar
morris520
Forum Commoner
Posts: 60
Joined: Thu Sep 18, 2008 8:56 pm
Location: Manchester UK

Re: php ajax chat room will increase server load?

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: php ajax chat room will increase server load?

Post by VladSun »

It uses long polling technique, it's not real "server push".
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: php ajax chat room will increase server load?

Post 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.
User avatar
morris520
Forum Commoner
Posts: 60
Joined: Thu Sep 18, 2008 8:56 pm
Location: Manchester UK

Re: php ajax chat room will increase server load?

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: php ajax chat room will increase server load?

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: php ajax chat room will increase server load?

Post by pickle »

Why re-invent the wheel?

PHPFreeChat
PHPChat
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: php ajax chat room will increase server load?

Post by jackpf »

What's the fun in that?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: php ajax chat room will increase server load?

Post 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. :wink:
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: php ajax chat room will increase server load?

Post by jackpf »

Yeah, high five for writing your own programs and not blindly copying scripts off the internet....
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: php ajax chat room will increase server load?

Post 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.
Post Reply