Question in regarding server resource consumption

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
Shogun
Forum Newbie
Posts: 1
Joined: Mon Jan 17, 2005 10:45 pm

Question in regarding server resource consumption

Post by Shogun »

I have a question in regrading to server resource consumption. Assume I have a Webpage that has quite large daily traffic, say around 20,000 visits per day. The content of this Webpage is stored in a MySQL database and updated every 15 minutes. Which one of following ways consume less server rescource (CPU time, memory usage etc.)?
* use PHP to generate a static page(a HTML file) and re-generate this page every 15 mintues when database is updated. So, basically, all the visits will load the sataic HTML page.
* use PHP, make this Webpage dynamic. So every visit will execute the PHP script.

I am not sure if I have explained my concerns clearly or not. Hopefully, yes~ and thanks for any suggestion and help in advance.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

a/1/uno will pretty much always consume less resources, but then you have to build a system to tell the page's text to update.

in reality, 2 doesn't consume all that much, of any of those, as php is still running...

You can do a medium, where the page is a php script that on demand, can check if the database has updated since last request. If not, it could use a cached file it creates. This could be done with a check on the cache file's mtime property, to minimize the database connections and queries.

20K hits per day isn't a whole lot of strain on php to handle for a given set of page.
Post Reply