Writing files on server through CGI

A

amaltasb

I have a CGI script on server which process a form and writes its
content on a file like
fp = open(fname, 'w')
fp.write('<HTML><HEAD><TITLE>Cool
list</TITLE></HEAD><BODY><H2><CENTER>%s</CENTER></H2><BR><H3><center>%s</center></h3></body></html>

Its working fine, but will it work if the script recieves thousands of
request simultaneously.
Can this script writes files simultaneusly or will all the request
queued and processed one by one. If that is the case then how can I
make this script work so that it can process several requests at a
time.

Thanks
Amaltas
 
C

Christoph Haas

I have a CGI script on server which process a form and writes its
content on a file like
fp = open(fname, 'w')
fp.write('<HTML><HEAD><TITLE>Cool
list</TITLE></HEAD><BODY><H2><CENTER>%s</CENTER></H2><BR><H3><center>%s</center></h3></body></html>

Its working fine, but will it work if the script recieves thousands of
request simultaneously.

I assume that's a question. No, it won't. If you open a file for writing no
other program can write to it.
Can this script writes files simultaneusly or will all the request
queued and processed one by one.

Sorry, no. What is your intent? Usually you either have CGIs that output
HTML directly or scripts that update an HTML file. But CGIs that write to a
HTML file... that looks pretty uncommon.

Don't worry about updating a static HTML file though. If you are using
a decent web server like Apache it will have the file cached and try to
read it once you are done changing it. But don't use CGIs for that.

Christoph
 
A

amaltasb

this cgi script write different files, request 1 will write 1.html, 2
will write 2.html and so on.
Its not updating the current file.
For example create.py processes a form and write user.html file and
every user is unique.
so if 10 users fill up the form at the same time and click submit
button, can create.py file write 10 html file simultaneously or will
all the request be queued and executed one by one, because at any given
point there can be several users creating this html page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,292
Messages
2,571,494
Members
48,178
Latest member
SusanaHam4

Latest Threads

Top