Solved

Updating *HEAVILY* Accessed HTML Web Page

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can i open a .fxp file 3 51
Perl script to process a .csv file 18 65
Permission on folders 6 24
Understanding ping command in Ubuntu 5 33
This article will show, step by step, how to integrate R code into a R Sweave document
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

733 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