?
Solved

Updating *HEAVILY* Accessed HTML Web Page

Posted on 1997-12-30
5
Medium Priority
?
257 Views
Last Modified: 2013-12-25
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!
0
Comment
Question by:ljaques
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 5

Expert Comment

by:icd
ID: 1831780
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.

0
 
LVL 84

Expert Comment

by:ozo
ID: 1831781
Why is the rename failing?
0
 
LVL 1

Expert Comment

by:nanullnet
ID: 1831782
see similar question in perl area
0
 
LVL 1

Accepted Solution

by:
nanullnet earned 200 total points
ID: 1831783
You do not need to worry about a user accessing an html page while you are updating it. The web server handles the order it services requests. So simply write the new file and rename it. The user serviced right before will get the old page, the user next in line will get the new page when you are done.  

0
 

Author Comment

by:ljaques
ID: 1831784
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!
0

Featured Post

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question