Ticket #358 (closed defect: fixed)

Opened 6 years ago

Last modified 15 months ago

Optimize page caching ($pageCache doesn't work well)

Reported by: hiRainChen@… Owned by: DotMG
Priority: normal Milestone: 1.3.1
Component: core Version:
Severity: normal Keywords: pageCache, optimization, cache
Cc:

Description (last modified by DotMG) (diff)

how to show out the bug: set the config "sql_debugging" to 1,then at the bottom you will find such as:

...
select * from wikka_pages where tag = 'HomePage' and latest = 'Y' limit 1 (0.0024969577789307)
select * from wikka_pages where tag = 'HomePage' and latest = 'Y' limit 1 (0.0021030902862549)
...

the $pageCache doesn't work.

bug reason: 'HomePage' in the database is low case as 'homepage';

how to fix:

/lib/Wakka.class.php in the function : function LoadPage

find below code: $this->pageCache[$pagetag?] = $page;

should be : $this->pageCache[$tag] = $page;

Change History

Changed 6 years ago by TormodHaugen

The only problem I can see here is that a page is linked to with another name than what it has been created with. If the page exist as 'homepage' in the database, then 'root_page' should be set to 'homepage' in wikka.config.php?

In the function LoadPage, $tag is what the user asks for, and $pagetag? (should be $pagetag?) is what the page is actually named.

The bug here would then be that the page has been saved with the tag 'homepage' instead of 'HomePage' in the first place.

Changed 6 years ago by DotMG

  • owner changed from unassigned to DotMG
  • status changed from new to assigned
  • description modified (diff)
  • milestone set to 1.1.7

I'm afraid this bug is valid. Since Wikka caches page, the query select where tag = 'HomePage' shouldn't have been executed twice. The second attempt should have read it from cache.

But the resolution proposed is not efficient. It should be

$page = isset($this->pageCache[strtolower($tag)]) ? $this->pageCache[strtolower($tag)] : null;
...
$this->pageCache[strtolower($tag)] = $page;

I look further.

Changed 6 years ago by TormodHaugen

Ok. That might be; I did my testing on trunk from svn, and did not run into the problem (only one call per page linked, even if more than one link.)

Have pages with CamelCase names and pages with lowercase names. Get extra call when asking for HomepAge, so strtolower($tag) would help as a fix against #61 (where my 3.5 cents are on "do nothing").

Changed 6 years ago by DotMG

  • keywords pageCache, optimization, cache added; pageCache removed
  • summary changed from php var $pageCache doesn't work well to Optimize page caching ($pageCache doesn't work well)

The changeset for this ticket has fallen into a big optimization of the page caching mechanism.

Creating a mechanism for caching page loaded by LoadPageById().

Make LoadPageById() retrieve page from cache if the id was previously loaded using LoadPage().

Changed 6 years ago by DotMG

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in [209] for the pagecaching.

LoadUser() can be optimized too, this will be addressed in ticket #368

Changed 6 years ago by DarTar

Hi Mahefa,

I just wanted to say that the optimization work is great! My local install really works much faster.

Changed 3 years ago by DarTar

  • milestone changed from 1.2 to 1.3

Retargeting to 1.3, this ticket has already been closed in trunk, from which 1.3 will be branched. Consider backporting urgent issues to 1.2.X

Changed 15 months ago by BrianKoontz

  • milestone changed from 1.3 to 1.3.1

Updated milestone to 1.3.1

Note: See TracTickets for help on using tickets.