Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Agreeing/expanding what has already been said, I don't think FastCGI will solve the problem.</p> <h2>Apache</h2> <p>Each request into Apache will use one worker thread until the request completes, which may be a long time for COMET requests.</p> <p><a href="http://ajaxian.com/archives/comet-with-apache-and-jetty" rel="noreferrer">This article on Ajaxian</a> mentions using COMET on Apache, and that it is difficult. The problem isn't specific to PHP, and applies to any back-end CGI module you may want to use on Apache.</p> <p>The suggested solution was to use the <a href="http://httpd.apache.org/docs/2.2/mod/event.html" rel="noreferrer">'event' MPM module</a> which changes the way requests are dispatched to worker threads.</p> <blockquote> <p>This MPM tries to fix the 'keep alive problem' in HTTP. After a client completes the first request, the client can keep the connection open, and send further requests using the same socket. This can save signifigant overhead in creating TCP connections. However, Apache traditionally keeps an entire child process/thread waiting for data from the client, which brings its own disadvantages. To solve this problem, this MPM uses a dedicated thread to handle both the Listening sockets, and all sockets that are in a Keep Alive state.</p> </blockquote> <p>Unfortunately, that doesn't work either, because it will only 'snooze' <em>after</em> a request is complete, waiting for a new request from the client.</p> <h2>PHP</h2> <p>Now, considering the other side of the problem, even if you resolve the issue with holding up one thread per comet request, you will still need one PHP thread per request - this is why FastCGI won't help.</p> <p>You need something like <a href="http://en.wikipedia.org/wiki/Continuation" rel="noreferrer">Continuations</a> which allow the comet requests to be resumed when the event they are triggered by is observed. AFAIK, this isn't something that's possible in PHP. I've only seen it in Java - see the Apache <a href="http://tomcat.apache.org/tomcat-6.0-doc/aio.html" rel="noreferrer">Tomcat server</a>.</p> <p><strong>Edit:</strong></p> <p>There's an <a href="http://iamseanmurphy.com/2009/03/02/high-performance-comet-on-a-shoestring/" rel="noreferrer">article here</a> about using a load balancer (<a href="http://haproxy.1wt.eu/" rel="noreferrer">HAProxy</a>) to allow you to run both an apache server and a comet-enabled server (e.g. jetty, tomcat for Java) on port 80 of the same server.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload