Re: Remote FastCGI server and Apache on Windows and persistent TCP/IP connections
Marc Prewitt <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Jose Adriano Baltieri wrote:
> I finally managed to set up Apache on Windows with a Remote FastCGI
> configuration.
>
> The trick is that the FastCGI module is only valid up to version 2.0 of
> Apache. So, never try it with 2.2.2. It wont work.
>
> On the httpd.conf, I added two lines like this :
>
> LoadModule fastcgi_module modules/mod_fastcgi.dll
> FastCgiExternalServer c:\apache2\htdocs\test.rfcgi -host localhost:101 -appConnTimeout 30 -idle-timeout 30
>
>
> Anyway, the problem is :
>
> Apache (or the FastCGI module) opens and closes a TCP/IP connection with
> the Remote FastCGI server for each transaction (hit).
>
> Is it supposed to be like that ?
Yes, this is the expected behavior. It's just like normal HTTP.
>
> Wouldn't be more clever to keep the TCP/IP connection opened ?
>
> Why is this a problem for me ? Because as I posted before, I'm writing
> my own FastCGI server. My idea was to create a thread for each
> connection and only release that thread when the tcp/ip connection were
> gone.
You can probably do something like this but you are going to have to
deal with how the browser works. Generally, it makes a request and then
disconnects.
You can however, make a cgi that never does a close.
>
> However, since Apache opens/close all the time, I'll create/destroy
> threads all the time (as well as the tcp/ip connections).
>
> I dont think that's much better than a CGI...
>
You're better off because normal CGI starts a process for each request
('hit') you receive. FastCGI starts the process once and then keeps the
process running and sends subsequent requests to the same running
process. The advantage is that you only have to do process
initialization once. If you start designing your app this way, you'll
start realizing that you can move more and more stuff to the
initialization phase and take better advantage of caching.
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/