Link to home
Start Free TrialLog in
Avatar of ljaques
ljaques

asked on

Updating *HEAVILY* Accessed HTML Web Page

I am planning on having hundred of thousands of hits on my web site; I am certain my web pages will be heavily accessed.

A problem I'm facing is the "hourly" updates to the web pages; Updates can be a one liner to the entire HTML page. My Hourly Bot uses a .BAK file of the present web page to create the NEW web page named: WEB_PAGE.tmp. Then it sits in a WHILE loop waiting for the RENAME function to rename (move) the WEB_PAGE.TMP file to the visible (what the client sees) WEB_PAGE.HTML.
ie:
                    while(!(rename("web_page.tmp","web_page.html"))
{sleep(3);}

Once the RENAME has succeeded, any new accesses to
WEB_PAGE.HTML will be faced with the NEW page. Great! But, if I have hundreds of thousands of users to the old page, the above WHILE loop will be in there forever!

Is there another way to somehow HALT/PAUSE the clients for a split seconds to copy over the old HTML file with the NEW one?? Or is my above method the best, most efficient way?!

Maybe I should pass all calls on my site to a CGI script which uses the status 302 LOCATION command to redirect the client to the proper page. This way, if the Hourly Bot posts a STOP SIGNAL this CGI script can take notice and "pause/halt" any new calls to an HTML page.

Please, any suggestions which can help me out of this dilema would be GREATLY APPRECIATED!
Avatar of icd
icd

I wish I knew how to get hundreds of thousands of users to my web site every day!

Seriously though. How about serving the page from a script, or ssi. The script could then test for the presence of the hourly bot trying to do a rename and serve the user an alternative page leaving the original file un-accessed and able to do a rename.

I suspect however that even with many concurrent accesses to that file there are going to be many windows of opportunity for the hourly bot to do a rename. If the file is so heavily used that there is *no* window then the server will not be coping very well with the load anyway. Your approach would seem to be workable.

Avatar of ozo
Why is the rename failing?
see similar question in perl area
ASKER CERTIFIED SOLUTION
Avatar of nanullnet
nanullnet

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ljaques

ASKER

So, renaming a my new .BAK file over the old HTM file is ok?
The server actions what Nanullnet mentions sounds a lot like a "stack".  If this is the case what if there's hundreds of thousands of users already on the stack before me.  I'd hate for the process to take forever.

If the "rename" is placed on the server stack then will my WHILE loop method return back immediately or does it sit in the loop forvere until the server gets to my request in its stack??

Tanx everyone.  Happy new Year!