Jump to content

Structure for ajax powered comments system


thomas
 Share

Recommended Posts

Hi,

I'm gonna try and build an ajax powered comments system and was planning to build the whole thing on a one comment == one page basis. The comment page having a textfield for the actual comment, a page field with the user page of the commenter (it will require registration) and a page field for the page that was commented on. Since Ryan's comments module uses simple DB entries I was wondering if this is a good plan and what the benefits of not having one page per comment are? Will I experience problems if a million people comment stuff on my site?

Thanks for hints an ideas!

thomas

Link to comment
Share on other sites

PW's database is really scalable in that each field is a table. This is fine, but for comments systems and other cases where you're only going to build the structure ONCE and scale it to millions of entries it can be preferable to have it in its own table.

For example, if you build it as PW pages to only have 3 fields - name, email and comment, that's 3 tables (but remember there are other tables that come into play! - the pages table and the field_title table have to be in there for each page!). Sure, it's quick enough since it's still the one query that's getting data from those tables, but it would save some overhead when you get to really large numbers of comments to have it as one table.

In fact I doubt the overhead would even be very high with separate tables doing it all as PW pages, so maybe ryan can elaborate on possible reasons to keep it separate.

  • Like 1
Link to comment
Share on other sites

I think that it would be fine to do it with PW pages, and have been played around with doing it that way myself (and may pursue it further in the future). But Pete is right that since comments are a fixed format, and potentially more vast than your site's content, it's more efficient for them to be in their own tables, separate from PW's pages. And that's the reason why PW's comments are their own thing, rather than pages. However, I think there are plenty of benefits to having them as pages too, but it is a bit of a compromise in efficiency for flexibility. And perhaps a worthwhile one. I'd say go for it. But ideally don't have any crossover with the fields you use for comments, and the fields you use on the rest of your site. That will ensure that the quantity/scale of the fields used by comments doesn't introduce any potential bottlenecks in your site's pages.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...