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

Michael Van Canneyt michael at freepascal.org
Fri Jan 30 17:25:06 CET 2015

On Fri, 30 Jan 2015, silvioprog wrote:

>       But if you are on a headless server, then a windows service is the only really viable way.
>       You can start messing with run entries in the registry, but the problem remains the same: the app must be running when the
>       webserver starts. Best way to achieve that is a service.
>       The alternative is to let the webserver control the program instances.
>       And except for debugging purposes, this is still the best approach IMHO.
> But it is very easy to solve it. In my case, when I talk about debug an applicationĀ running, it isn't about debug the final executable
> itself, but its implementation. If I start my EXE via Apache, it is impossible to debug it. Using proxy, I can add another server in
> my HTTP server (nginx allows to add more than one), something like "fcgi_pass <IP of my development machine>/dev/myapp", so I open my
> browser and access the URL of the server that is running publicly (probably on a machine in the clouds), and this server will call the
> application running here on my PC. I know my local application will be a replica of the one already published, taking the time/commits
> from the GIT log.

I know all this. I did this myself :)

Debugging is currently not the main problem IMHO. Performance is.

So I am glad you are investigating threaded fastcgi, I will be one of the first to test :)

Although I am sure this will raise other problems when converting existing fastcgi processes:
such as DB access which is not thread safe, 
cached data access which must be made thread safe etc. etc. etc.


More information about the fpc-pascal mailing list