I've got a section of my site that allows users to post "comments" on a certain type of page. Which option do you guys think would be better (as far as speed and performance goes): - pulling the comments from a mysql database on the fly - create pages and throwing them into the page via "include" - rewrite the actual page as a .html every time another comment is posted Just wondering, thanks!
how about pulling the comments from a DB on a schedule and including them >? Cron task every hour or so. Or update only when a new comment is added.
I would always prefer database. You have more control over data and unless your queries are very complex, it is faster then reading/writing to a file.
That statement's partially true. Reading from a file should be faster than a DB call. While DB calls do give you more options on what to do. If its a heavily frequented site, some type of caching should be employed. Just remember how long it takes for WP Blogs with Tons of comments to load. Do you want that for your site?
A simple HTML page is the lightest that you can do concerning your server resources, which is however completely painful to manage. As mentioned earlier, a DB concept with a caching engine would be the ideal.
For something as simple as a comments page I don't think there's much need to cache the db results but if there is a lot of traffic or it's more complex than I think then I would recommend Memcached
My advice is to use PHP script with mysql database for comments section in your site, If you want to optimize it for SEO you can use rewrite rules using .htaccess
That's what I was expecting. Thanks for all the responses. I'm going to try and do some speed tests on the server later. The site gets a decent amount of traffic, but nothing that should clog up a database too much.