Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I just had an idea: We should have a nodelet (allowed for all -- that is, in sidebar nodelets or the allowed-to-all section of allowed nodelets) that gives the current web & db server load (probably cached), and, perhaps more importantly, how much db load this page caused. (Being a nodelet means that it will miss load caused by later nodelets, but I think that's better then putting it at the very bottom, where it's too easy to not notice.)

The best way to do this would seem to be adding $NODE->{node_id} (the node id of the node being rendered) and $USER->{title} (the username of the logged-in user) (possibly also a unique id for the HTTP request, but I'm not sure how to generate that -- mod_perl, as opposed to CGI, thing, thing).

Then the nodelet would have to sum up the information by parsing the logfile.

Come to think of that, that last step is probably rather difficult. A better way may be for the loging methods to also add information to $HTMLVARS (a global hashref, which is reloaded with every request).

In fact, we could also add logic to add daily totals to $VARS (user settings), which show how much total DB load you have caused today. That may be too much overhead for the logging methods, though -- they'd have to check if the day has changed every time. Also, that would mean yet more data in each fetch and store of the user, which is generaly a bad thing.

If you want, I can start working up code.

Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

In reply to Re: Re: Node cache refactoring (DBI profiling) by theorbtwo
in thread Node cache refactoring by tye

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (10)
    As of 2020-02-21 14:53 GMT
    Find Nodes?
      Voting Booth?
      What numbers are you going to focus on primarily in 2020?

      Results (96 votes). Check out past polls.