In the case of CGI, the server starts a copy of the PHP interpreter every time it receives a request. PHP in turn starts the Python process, which gets killed after exec (). There is a huge overhead for starting two processes and performing all import operations for each request.
In the case of FastCGI or WSGI, the server saves progressive processes (the minimum and maximum number of running processes are configured), so for the price of some memory you get rid of starting a new process every time. However, you still have to start / stop the Python process every time you call exec (). If you can use a Python application without exec (), for example, part of PHP for PHP in Python, this will greatly improve performance.
But, as you mentioned, this is a small project, so the only important criterion is that your current server can support the current load.
source share