Well my daily job is system-admin and keeping a connection up for 30
seconds (if there are no updates) on sites with a high amount of
parallel visitors you will fastly reach the webserver max childs
limit, which will result in errorpages by the webserver that no more
children could be spawned.

Eg. you set your max clients to 800 (which is a real high amount btw.)
and you have eg. 200 simultanous visitors (big blog, board or social
sites) you will have 200 connections to the server up and running all
the time. Opening a new connection in a new tab / window will spawn a
2nd permanent connection for the same user and so on.

The second pitfall is, that most serverside scripts will use database
connections and will - surprise surprise - keep these connections open
all the time. MySQL Max Connections is about 1/3 - 1/4 of the max
webserver childs so you will easily reach the Database Max Connections
far before the Webserver Limit.

Keeping connections up is always a BAD solution if you do not use a
REAL Streaming-Server but a common Webserver (Apache, LightHTTP etc.)

So what would be a better solution is:

1) open Ajax connection and see if there is data to handle
2) after the server replied with or without data, process the
information
3) add a random delay of 0.1 - 0.5 second. This will help flushing
webserver / databaseserver childs and cpu load

This way you will have some kind of persistent connection even
"realtime enought" for a chat-application.

Just my 2 cent if there is someone out about to develope a mechanism
with usability on hughe sites.

Just forgot: most virttual hostings do limit the max processes on a
per user level. Say your virtual webhosting is limited to 50 user
processes your website will deliver error messages just after 50
visitors not closing their browsers.

On 3 Okt., 20:40, "asgaroth.belem" <[email protected]> wrote:
> Yeah actually I checked APE project (after this post) and i also found
> that mr benhutchins  also did anew implementation
> called real time Ajax
>
> Which is (as far as i understand) what APE project is using:
>
> The client starts a request (ajax)
> Then the server loops for at most 30 secs looking for an update.
> If there is no update the server send a message to refresh the
> conecction
> so the client just closes the first ajax as it gets the message but
> initiates
> a new Ajax request to the server.
>
> If the server had an update then it respons inmidiatly , the client
> then process the answer
> and starts a new ajax resquest, so "it is always active"
>
> Im not good in english and i dont know why i worte this, so you better
> read it from the author it self xD
>
> http://www.benhutchins.com/project/realtime-ajax
>
> On Oct 3, 11:03 am, Fábio M. Costa <[email protected]> wrote:
>
> > its because the guys code is a little problematic with big string.
>
> > changing the line 100 & 101:
>
> > response = text.split("<end />");
> > response = response[response.length-1];
>
> > to:
>
> > response = text.substring(text.lastIndexOf('<end />'));
>
> > helps A LOT on this.
>
> > --
> > Fábio Miranda Costa
> > Solucione Sistemas
> > Engenheiro de interface
>
> > On Sat, Oct 3, 2009 at 12:31 PM, Piotr Zalewa <[email protected]> wrote:
> > > Just a comment there (benhutchins implementation).
>
> > > <cite>After keeping the same connection open it will easily start using
> > > massive amounts of CPU for both a server and a web browser.</cite>
>
> > > I tried that and it becomes unusable very quickly.
>
> > > Piotr
> > > --
> > > London, UK

Reply via email to