Solved

Updating *HEAVILY* Accessed HTML Web Page

Posted on 1997-12-30
5
250 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
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 50 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now