Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-07

Apache processing cgi requests

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

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?

Note: For the release version, I changed the decrypted file to use a GUID Session ID in the output name - just to be sure there is no potential problems!

I am using Apache 2 with the MPM worker on a Linux box. The worker MPM provides a threaded implementation for Apache2.

Regards,
Graeme.

There's no place like 127.0.0.1

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 19 lines
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.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote 6 lines
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. Michael.

So I guess it was pure luck that we didn't pickup any issues. Thanks for your quick response!

Regards,
Graeme.

There's no place like 127.0.0.1

Reply by email