in reply to Re^4: Perlmonks site has become far too slow
in thread Perlmonks site has become far too slow

Some remarks/ideas for the logs:

> Every page is several database accesses

getNodeByID in Everything/NodeBase.pm is using a cache when accessing the DB.

472: sub getNodeById 473: { ... 488: # See if we have this node cached already 489: $cachedNode = $this->{cache}->getCachedNodeById($N); 490: return $cachedNode unless ($selectop eq 'force' or not $cach +edNode);

see also Everything/NodeCache.pm

I suppose the gods have increased the cache-size from the initial 300 in Everything/NodeBase.pm?

095: $db->{cache} = new Everything::NodeCache($this, 300);
Does the caching prioritize based on access count, I have to admit this is not easy to grasp.

> so there is no set of "hot" nodes.

there is no set of hot posts (which are internally nodes) but specific code and html nodes certainly are heavily used internally (AFAICS is 99,9% of the monastery held in DB-nodes)

> and several Perl eval calls

using memoization of in Everything/HTML.pm might help here to avoid unnecessary compilations

968: sub evalCode { 969: my( $code )= shift @_; 970: my( $CURRENTNODE )= shift @_; 971: # Note! @_ is left set to remaining arguments! ... 985: my $str = eval $code; ...

(tho there might be a side effect of pre-compiling into an extra sub layer)

something like (untested)

my $sub = $evalcode_cache{$str} //= eval " sub { $str }"; my $str = $sub->(@_);

html caching

an internal caching of the result of std_node_display into the DB might help too, but here plenty of side parameters need to be taken into consideration.

A caching for Anomonk alone must take into consideration (at least)

A pragmatic solution would be to not list the content of all replies for Anomonk, just the links to the direct replies.

The "print view w/o replies" is already close, but doesn't include links to children replies yet.

compare https://perlmonks.org/?node_id=11164875;displaytype=print

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery