locked
does fastcgi module support multi-thread fastcgi server? RRS feed

  • Question

  • User-40660713 posted

    i test some examples  with OpenMarket libfcgi on IIS 7, including the one (threaded.c) on fastcgi.com.

     though there are many thread created, but seems got a dead lock when get the lock.

     next i remove the lock code around ' rc = FCGX_Accept_r(&request);',but only one of threads can select/accept sockets and make right response.           

     btw, in IIS manager, i set to use TCP. with NamedPipe, all threads will idle at WriteFile(in os_win32.c), i think it caused by different thread read/write the same fileHandle, am i right?

    Tuesday, February 24, 2009 9:58 AM

Answers

  • User511787461 posted

    Since each fastcgi process will only receive one request at a time - making it multi-threaded is kind of pointless, right?  You can make it multi-threaded if you want, you still have to synchronize any data receives/sends.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, February 24, 2009 12:37 PM

All replies

  • User511787461 posted

    Since each fastcgi process will only receive one request at a time - making it multi-threaded is kind of pointless, right?  You can make it multi-threaded if you want, you still have to synchronize any data receives/sends.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, February 24, 2009 12:37 PM
  • User-40660713 posted

    thx for your reply.

    since use few process but more threads maybe faster and more responsibility on windows, is there any plan upgrading fastcgi mod to make fastcgi app process can accept more than one request from IIS fastcgi manager? then we can use threads for processing some requests (in queque with current version mod) at same time, with lower costs.

    with current version, is there any setting to keep min (always running) instances count?

    Wednesday, February 25, 2009 2:41 AM
  • User511787461 posted

    The main reason for the IIS fastcgi support is that the IIS CGI support is pretty slow and the ISAPI support does not work for techonologies that are used to single-threaded request processing on apache and are hence not thread safe (eg many 3rd party php libraries) - so the fastcgi support provides single threaded processing while improving performance by many orders of magnitude compared to CGI.  If you really wanted multi-threaded execution of requests, the ISAPI API (or the new IIS7 modules APIs) would be the one to consider rather than trying to get fastcgi to support multiple concurrent requests.

    Wednesday, February 25, 2009 2:13 PM
  • User-40660713 posted

    i see.

    thank you for your suggestion, and sorry for my poor english :)

    Wednesday, February 25, 2009 2:36 PM