Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
How to Scale Better Feature Requests
By fluffy grue , Section Wishlist []
Posted on Sat May 11, 2002 at 12:00:00 PM PST
Or: How to keep "The Thread That Wouldn't Die" from crashing Kuro5hin and certain browsers without crufty pagination hacks.

Oh, and Adequacy's famous Linux article, while we're at it.

First (but less important), to ease up on memory usage, convert the comment tree traversal stuff to be iterative, not recursive. This isn't very difficult - rather than making a recursive function call, just maintain a stack of the current location in the comment tree and push/pop by yourself.

Second (and this is where the important stuff happens), have two limits (configured for the server, but have it possible for the user to specify lower limits if they like): depth and count. Depth simply restricts how deep the comment traversal can go, and count simply restricts how many total comments can be displayed.

When a depth limit (which should probably be around 20) is hit, instead of displaying the child comments, display a message like "Continued..." which is a link to the last comment which was displayed.

When the total comment limit (which should probably be around 250) is hit, continue traversing comments until you get back up to the top display level, and display a message like "Continued..." which is a link to displaying the comments, starting traversal at the first toplevel comment to not be displayed.

Implementing these changes shouldn't be too difficult (in fact, I might even download the codebase to try at it), but it seems like a much better solution than Slash's "overload mode." It wouldn't break the continuity of discussions, it wouldn't overload Scoop due to having to touch a large amount of the comment database or due to extreme recursion, and it'd present a friendly, consistent interface which prevents browsers from getting really bad.

< Rio de Janeiro, Brazil | One year ago today... >

Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Login
Make a new account
Username:
Password:

Poll
Good idea?
· Yes 80%
· Maybe 20%
· No 0%

Votes: 5
Results | Other Polls

Related Links
· Scoop
· Kuro5hin
· More on Feature Requests
· Also by fluffy grue

Story Views
  68 Scoop users have viewed this story.

Display: Sort:
How to Scale Better | 7 comments (7 topical, 0 hidden)
Recursion is evil! (none / 0) (#1)
by juahonen on Tue May 14, 2002 at 11:43:59 PM PST

At least with Perl it is. Current version of Perl (don't know about v6) stores recursive functions on stack, in whole. Deep recurion will end up using a great deal of memory. Recursion might be simpler to implement but it is not worth it. And even if memory is cheap, the time spend filling it with useless information is not.

I disagree with the limits though. But it could be useful, if let for users to configure. On my Linux browsers there are no problems with long K5 (or Adequacy) pages. However, due to the nature of Windows resources, Internet Explorer 4 (haven't tested on later versions because they refuse to install themselves on my 98) chokes up when there are ~> 1000 handle-possessing elements on a page.

IIRC using limits like this would break up the current design for "seen" comments. If it is so, then limiting display would unnecessarily complicate this very important feature.





iirc... (none / 0) (#2)
by hurstdog on Wed May 15, 2002 at 12:01:05 AM PST

(note, I rarely hack the comments code :) The comments is implemented now by one large query. Get all the comments for a story. Then, put them into an array and generate the page as needed. The way you describe, we could probably still do that, but then we'd still have the problem of slowing down the site on large pages. To find all of the comments in a thread, if the thread was 20 deep, and we didn't want all of the comments in the story, it would take 20 queries. Which is not good, either.

What would be optimal, would be a way to get all of the comments in a thread via one quick query. The quickest way I can think of to do that would be to use stored procedures, but I'm not familiar enough with those to know how much it would help.

Regarding the recursion, its ugly too. The way some of the functions in comments.pm work now, its like this. foo() calls bar(), who calls foo() who calls bar()... and on and on. Its not easy to follow. And it breaks my script that maps out control flow in scoop ;)



-hurstdog


How to Scale Better | 7 comments (7 topical, 0 hidden)
Display: Sort:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search