[fpc-pascal] How to use FCGI in threaded mode?

silvioprog silvioprog at gmail.com
Sun Feb 15 05:30:32 CET 2015


Oops ... I sent an incorrect example ...

Please use this new example in attached, it is the correct example.

On Sat, Feb 14, 2015 at 11:51 PM, silvioprog <silvioprog at gmail.com> wrote:
[...]

> I was able to make the example works in "enablereuse=on" mode! =)
>
> It was not necessary to change the mycustfcgi.pas, it is the same as the
> previous example.
>
> This made the application more responsive, now I hold the F5 key on the
> browser and I can see the millisecond changing on the screen, even with
> another tab "locked" in a 10-second loop. In the first example it was not
> possible.
>
> In that second example was added the "KeepConnection" property. If it is
> False, the application will work as the first example that I sent: each
> connection is closed in the end of request. If it is True, it will only
> open a new thread if the first thread was still occupied in any processing,
> otherwise the AcceptConnection of the application will be used.
>
> I'm really impressed with the great performance achieved, please check
> this log below (Chrome debug the result):
>
> KeepConnection = False
> --
>
> *Status 200 OK - Loading time: 1022 ms*
>
> KeepConnection = True
> --
>
> *Status 200 OK - Loading time: 8 ms*
>
> To test it, download the attached example, unzip and run it. Using Apache
> 2.4.12+, make the following change in your httpd.conf:
>
> LoadModule proxy_module modules/mod_proxy.so
> ProxyPass /test fcgi://localhost:8080/ enablereuse=on
> LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
>
> PS: in the code there is the comment "we will in Place the thread pool
> here ...", showing that at that point we will implement the thread pool,
> with a thread-safe list.
>

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150215/cd49b172/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FastCGI_Proxy_Apache24_II.zip
Type: application/zip
Size: 10831 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150215/cd49b172/attachment.zip>


More information about the fpc-pascal mailing list