Forum Moderators: coopster

Message Too Old, No Replies

Generating PHP pages on request vs. pulling them from mysql

Is it ever preferable to preassemble dynamic pages & store them in a DB?

         

intrepidbunny

6:02 am on Jun 30, 2005 (gmt 0)

10+ Year Member



This question is related to one posted here a few days ago.

I'm wondering the pros and cons of "preassembling" PHP pages and storing the code in a mysql table rather than parsing them on the fly.

I run a nationwide business directory, and each business' profile draws data from about 13 tables. In the past few weeks our traffic has shot up to 35,000 pageviews/day, which caused our dedicated server to lag a bit. To speed things up, I started storing each profile's HTML code in a table, hoping that a single mysql request (upon each pageview) would be much more efficient than a dozen. (The code is refreshed any time a member makes a change to his/her profile.)

This approach seems to be faster, but I'm not sure what the consequences will be as our traffic continues to rise. Thoughts? Advice?

jatar_k

4:13 pm on Jun 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld intrepidbunny,

I think a caching solution would work equally well, if not better

the approach is similar.

I wouldn't store them personally, there really isn't any point, why not just have a site generator that generates all of the pages and serves them up as static.