[fpc-pascal] Apache processing cgi requests
Michael Van Canneyt
michael at freepascal.org
Wed Jul 26 10:39:00 CEST 2006
On Wed, 26 Jul 2006, Graeme Geldenhuys wrote:
> For all those Apache and CGI gurus...
> [This might be off-topic]
> I have written a CGI app for my client that decrypts a Macromedia
> Flash files (*.swf) to a set path and name ("/flash/movie.swf"), I
> then generate a html file to view that file, and the client (web
> browser) gets served. The average *.swf file size is around 100Kb.
> This CGI app might serve around 30-40 people simultaneously at peak
> times. In our testing, I would have thought that even though all
> 30-40 people are viewing different *.swf files, some might get served
> the wrong file (due to the decrypted file always having a constant
> name). Our testing proved otherwise, we always received the correct
> swf movie?
> This brings me to my question. How does Apache handle CGI requests?
> Does it queue them and serve them (including all resources: images,
> swf files, etc) one at a time or process them all at the same time?
They are processed at the same time. Apache works threaded, so multiple
versions of your CGI script could be running at the same time. You could
simply have used the GetTempFileName function from SysUtils to avoid
concurrency problems. Although using a GUID as a filename is just as good.
More information about the fpc-pascal