3

Why would a Comet Server like Tornado be especially prone to memory leaks if written in PHP?

Are there genuine weaknesses particular to PHP for implementing a long polling framework/service like Tornado?

Thanks

algorithmicCoder
  • 6,595
  • 20
  • 68
  • 117

1 Answers1

4

The gist of it is that PHP was originally written with the intent of having a brand new process for every request that you could just throw away once said request ended, at a time where things like Comet and long polling weren't really on the table.

As such there are quite a few areas - notably the garbage collector - where at its origin PHP just wasn't made for running during a long period of time, and it didn't care much because every http request got a brand new php instance.

It got clearly better in the recent years, but I still wouldn't use it for creating that sort of long-lifetime applications.

Lepidosteus
  • 11,779
  • 4
  • 39
  • 51
  • Thanks!..i see...but i assume it OK as the client in a comet arrangement? The connection is held for ~1 minute but this is much smaller than the overall time that the comet server has to be running for... – algorithmicCoder May 26 '11 at 00:35
  • Yes it is very much ok in such a situation – Lepidosteus May 27 '11 at 11:01