Closed Bug 436877 Opened 17 years ago Closed 16 years ago

Make "Since your last visit" not affect performance

Categories

(support.mozilla.org :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jason.barnabe, Assigned: ecooper)

References

Details

(Whiteboard: tiki_bug, tiki_upstreamed)

Attachments

(2 files)

another way could be limit it by language. It displayed changes for all wiki-pages, including those in a different language.
I'd like to put this on the radar as the functionality is important for contributors but performance is hindering us from using it.
Target Milestone: --- → 0.9
Blocks: 415726
Target Milestone: 0.9 → 0.8.2
Assignee: nobody → smirkingsisyphus
Is it correct to assume we're talking about webroot/modules/mod-since_last_visit_new.php?
Instead of hacking the current webroot/modules/mod-since_your_last_visit_new.php, I created a new module and template. It reuses the same code architecture of the original, but adds limits for display and separates the counting query from the actual data-fetching query. That being said, I'm still a little unsure about this, and I'm not sure how useful this will be. I think the better alternative would be something like a devoted page contributors can visit to see changes since their last visit.
Bottom is expanded, top is not. Limits can be specified for each type of change with a failsafe default of 25 (which can also be changed). In the screenshot, new posts have been arbitrarily limited to displaying the latest 3.
Where is this enabled? I forgot. I don't see any "since last visit" module in <https://support-stage.mozilla.org/tiki-admin_modules.php>.
On tiki-admin_modules.php, look under the "Assign new module". The original is listed under the "Module name" drop-down as "since_last_visit_new". It's currently disabled. The patched version isn't on staging.
Did some basic benchmarking. The old queries seem to be able to return large datasets in a relatively timely manner (especially compared to some of tiki's more frequently used queries). This new module is faster never the less. If anything, the problem looks like PHP had to also loop through the entire set (which as Jason noted can be massive), do some conditionals, do some permission checks, etc.
How much faster is the new module - 5%, 50%, 500%?
As I mentioned, the problem doesn't look like it's an issue with db queries (though, they've been made much more scalable), but with the code handling what the queries were returning. As an example, passing 1000 new forum posts (Jason's original report said he saw 1700) to old module will cause a timeout locally. That means >60s execution time for the entire script (most likely poor smarty trying to parse and loop through a 1K array). The new module takes an extra .7s to load the page with the same data. The real issue here is parsing and then passing massive arrays to smarty is very, very bad for script execution time. (In reply to comment #9) > How much faster is the new module - 5%, 50%, 500%?
Oh, I should also mention these numbers are local. On staging or production, performance should be even better.
Maybe it would be more efficient to create separate handling for this in PHP and somehow split the display of the site in such a way that the array is not passed to smarty? For example, if we smarty->display the parts before and after the array using some smarty templates, but keep the array part in php. Would this work? Perhaps through duplicating some templates content. Maybe it's worth evaluating the work costs of doing this versus not.
Target Milestone: 0.8.2 → 0.9
If you passing a massive array to smarty, you're probably doing something wrong on the UX side of things. ;) In any case, is everyone on board with me committing this new module for testing/refinement on staging?
Eric, can you get a review from e.g. Laura first? Otherwise I like the plan!
Attachment #357964 - Flags: review?(laura)
Attachment #357964 - Flags: review?(laura) → review+
Moving this to 1.0. I'm getting a JS error when included on the contributor homepage and *only* the contributor homepage. If I figure it out tonight, I'll move it back into 0.9.
Target Milestone: 0.9 → 1.0
What's the status of this bug?
(In reply to comment #16) > What's the status of this bug? Should be in on staging Tuesday or Wednesday depending on the l10n dashboard progress.
I can't seem to reproduce the error in comment 15 after taking another look at this on two separate occasions over the last week. It's in r23339/r23340 and can be activated on staging by using the since_last_visit_lite module.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
(In reply to comment #18) > I can't seem to reproduce the error in comment 15 after taking another look at > this on two separate occasions over the last week. It's in r23339/r23340 and > can be activated on staging by using the since_last_visit_lite module. Error: setfolderstate is not defined Source File: https://support-stage.mozilla.org/en-US/kb/Contributor+Home+Page Line: 1030 Eric, was that the error message you saw?
(In reply to comment #19) > Error: setfolderstate is not defined > Source File: https://support-stage.mozilla.org/en-US/kb/Contributor+Home+Page > Line: 1030 > > Eric, was that the error message you saw? No. I think that's related to the collapsible Admin folders in the right nav. The error I saw prevented the module from expanding and collapsing. For some reason, an inline rule for visibility was (incorrectly) being set. I haven't seen it since, though.
I don't see comment 15's error either. Marking verified fixed; I don't see end-user performance hits due to this, and it looks like Eric has done some performance testing too. (Reopen if the crack I'm smoking is better than usual!)
Status: RESOLVED → VERIFIED
Whiteboard: tiki_bug
As we've been trying to reduce module duplication very recently, introducing yet an other module for recent changes is not an option. The fact that it's a separate file makes it very hard to see the changes. One of the major changes is obviously the limitation of records displayed. Are there any other changes? I would upstream this change by adding a parameter to the module instead.
Whiteboard: tiki_bug → tiki_bug, tiki_discuss
It seems to me that if LPH's solution in comment 22 isn't sufficient for us, we could always go back to using Eric's module in the SUMO installation. I'm not sure what other changes were made, but I'm pretty comfortable with whatever you think is best, Louis-Philippe.
The most important part of my message was "Are there any other changes?".
Applied a maximum amount of results fetched. If there are still performance issues after the port, they should be tracked individually rather than reverting to the old module.
Whiteboard: tiki_bug, tiki_discuss → tiki_bug, tiki_upstreamed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: