0

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?

Jerome Ansia
  • 6,854
  • 11
  • 53
  • 99

2 Answers2

1

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.

AlienWebguy
  • 76,997
  • 17
  • 122
  • 145
  • What could kill more the server is the number of request than keeping the connection alive no? so the bigger time out the better? – Jerome Ansia Apr 06 '12 at 17:27
  • Too bad i did it with custom code already, everything is already set up but thanks for NodeJS i'll keep this in mind ;) – Jerome Ansia Apr 06 '12 at 17:28
1

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.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
  • i was thinking that they were using Apache thanks, yes i know that's the biggest downside of Apache the number of connections... :/ There is certainly a reason to this that i don't know ;) The commons programmers don't care also i guess – Jerome Ansia Apr 06 '12 at 17:40
  • How is compiled PHP more powerful than Apache? You're comparing apples and oranges. All hip hop does is ease the strain on the CPU during the PHP logic execution - it has absolutely nothing to do with long polling or connections or anything. – AlienWebguy Apr 06 '12 at 18:40