Jerome Ansia
Jerome Ansia

Reputation: 6884

Long Polling set_time_limit() to the max possible

I'm wondering how to set the max possible time limit for a php page,

set_time_limit(number);

I looked of on the long polling that Facebook use it's 40 seconds why this number and not more ?

Is it a best practice because then the browser will cancel the request or something?

Upvotes: 0

Views: 1632

Answers (2)

René Höhle
René Höhle

Reputation: 27285

You should think about that Facebook use HipHop as own developed software.

They compile their sources from php to c++. This is more powerfull then Apache. And can handle more connections and many more.

If you want to test it and get some more experience here is a tutorial.

Upvotes: 1

SeanCannon
SeanCannon

Reputation: 77956

No, that's the execution time limit, not the http connection time limit. HTTP 1.1 uses a persistent connection, meaning it won't time out, so your limitation would actually be Apache not PHP.

Read up on Apache's max clients to see if long polling will kill your server or not. http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients

All that being said, if you really want a solid long polling setup, I'd recommend looking into NodeJS to use a non-blocking I/0.

Upvotes: 1

Related Questions