[fpc-pascal] How to use FCGI in threaded mode?
silvioprog
silvioprog at gmail.com
Sun Feb 15 06:07:23 CET 2015
And it work fine in nginx too (it is very fast =o ), using this
configuration:
upstream fastcgi_backend {
server 127.0.0.1:8080;
keepalive 8;
}
location /test {
fastcgi_pass fastcgi_backend;
fastcgi_keep_conn on;
...
}
Loading time: 4 ms
On Sun, Feb 15, 2015 at 1:30 AM, silvioprog <silvioprog at gmail.com> wrote:
> 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
>
--
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/ef04464e/attachment.html>
More information about the fpc-pascal
mailing list