PEP 594 cgi & cgitb removal

Robin Becker robin at reportlab.com
Wed May 29 03:17:57 EDT 2019


...........
> 
> More specifically, with CGI the webserver starts a new process for every single request. That's bad enough for a light C program, 
> but it's certainly not a good idea to start a whole new Python process for every request. At least not for any production website 
> or web service that serves any real amount of traffic.
> 
> That is, for those who didn't know, the reason why CGI fell out of use quite some time ago.
> 

Well I'm afraid I cannot agree with that reasoning. ReportLab used cgi exactly because it starts a new process; most of the 
reports that are generated take more than a second to generate so the startup time is of less importance. Starting up in a clean 
state is of importance because the sharing of resources across different reports often leads to buggy report code such as relying 
on an earlier report to load fonts, define colours etc etc. This could perhaps have been done with multiple interpreters eg 
mod_python, but I think the isolation there is not perfect especially with C extensions.

It might be that the new 'cgi' doesn't use the older api and in that sense we could just use wsgi or whatever the new interface 
is, but I would still use cgitb to provide nicely formatted traceback html.
-- 
Robin Becker




More information about the Python-list mailing list