Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: Perlmonks site has become far too slow

by LanX (Saint)
on Aug 31, 2025 at 19:19 UTC ( [id://11166149]=note: print w/replies, xml ) Need Help??


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)

  • if the sub-tree of replies has changed
  • if the content of the post or any reply has changed by update
  • if the down-votes for a reply has reached the so called "crap-level" to be hidden
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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11166149]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2026-02-10 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.