Loading ...
Sorry, an error occurred while loading the content.

[mp2] pnotes-like facility for $c connection object?

Expand Messages
  • Jeff Ambrosino
    I ve made great use of $r- pnotes, and now finding myself in need of a similar way to stash objects within the connection object. While there are regular
    Message 1 of 6 , Oct 24, 2005
    • 0 Attachment
      I've made great use of $r->pnotes, and now finding myself in need of a
      similar way to stash objects within the connection object. While
      there are regular 'notes' offered by the connection ($c->notes),
      unfortunately there is no 'pnotes'. Any suggestions for a workaround?

      The requirement is as follows: to store a Time::HiRes object in a
      pnote for establishing HTTP cycle benchmarks. Using Time::HiRes, I've
      already done this successfully to benchmark the "round trip"
      associated with my mod_proxy's request to the web server. But, since
      I also run mod_ssl, my requirement now is to be able to benchmark the
      SSL handshake phase on the proxy itself by measuring elapsed time
      (tv_interval) between ProcessConnectionHandler and
      PostReadRequestHandler. As you can see, it's all very simple, except
      where to store the Time::HiRes object from the
      ProcessConnectionHandler? I'm hoping there's a decent way to do this
      without resorting to $c->notes and serialize/freeze/thaw...

      Thank you in advance for any ideas/suggestions.

      cheers
      JB

      p.s. off-topic inquiry: does anyone happen to know (roughly) what the
      division of computational labor is between client and server during an
      SSL handshake? For example (contrived numbers): 40% of the
      computational work is done by the client, 60% by the server... any
      ideas?
    • Geoffrey Young
      ... hmm, that s a good idea. it will require a patch of some difficult, though. if I have time this week I ll give it a whirl... --Geoff
      Message 2 of 6 , Oct 24, 2005
      • 0 Attachment
        Jeff Ambrosino wrote:
        > I've made great use of $r->pnotes, and now finding myself in need of a
        > similar way to stash objects within the connection object. While
        > there are regular 'notes' offered by the connection ($c->notes),
        > unfortunately there is no 'pnotes'. Any suggestions for a workaround?

        hmm, that's a good idea. it will require a patch of some difficult, though.
        if I have time this week I'll give it a whirl...

        --Geoff
      • Geoffrey Young
        ... try this patch, which makes the following possible use Apache2::ConnectionUtil (); ... my $note = $c- pnotes( foo ); you ll need to make realclean before
        Message 3 of 6 , Oct 25, 2005
        • 0 Attachment
          Jeff Ambrosino wrote:
          > I've made great use of $r->pnotes, and now finding myself in need of a
          > similar way to stash objects within the connection object. While
          > there are regular 'notes' offered by the connection ($c->notes),
          > unfortunately there is no 'pnotes'. Any suggestions for a workaround?

          try this patch, which makes the following possible

          use Apache2::ConnectionUtil ();
          ...
          my $note = $c->pnotes('foo');

          you'll need to 'make realclean' before applying the patch, then completely
          rebuild again in order for the new method to be picked up and the tests to
          be present.

          the tests are in the (now expanded) t/modperl/pnotes.t test. I've tested it
          against 2.0 (worker) and 2.1 (prefork) and it seems to work and not
          coredump, but more vigorous testing always appreciated.

          --Geoff
        • Geoffrey Young
          ... blarg, that patch was incomplete. here s the right one (I hope). sorry. --Geoff
          Message 4 of 6 , Oct 25, 2005
          • 0 Attachment
            Geoffrey Young wrote:
            >
            > Jeff Ambrosino wrote:
            >
            >>I've made great use of $r->pnotes, and now finding myself in need of a
            >>similar way to stash objects within the connection object. While
            >>there are regular 'notes' offered by the connection ($c->notes),
            >>unfortunately there is no 'pnotes'. Any suggestions for a workaround?
            >
            >
            > try this patch

            blarg, that patch was incomplete. here's the right one (I hope).

            sorry.

            --Geoff
          • Torsten Foertsch
            ... Just a thought, will that work with ITHREADS? Torsten
            Message 5 of 6 , Oct 25, 2005
            • 0 Attachment
              On Tuesday 25 October 2005 20:18, Geoffrey Young wrote:
              >  typedef struct {
              >      MpAV *handlers_connection[MP_HANDLER_NUM_CONNECTION];
              > +    HV *pnotes;
              >  } modperl_config_con_t;

              Just a thought, will that work with ITHREADS?

              Torsten
            • Geoffrey Young
              ... hmm... well, I don t see how it s any different than the same declaration in modperl_config_req_t, and my worker tests seemed to pass ok the dozen or so
              Message 6 of 6 , Oct 25, 2005
              • 0 Attachment
                Torsten Foertsch wrote:
                > On Tuesday 25 October 2005 20:18, Geoffrey Young wrote:
                >
                >> typedef struct {
                >> MpAV *handlers_connection[MP_HANDLER_NUM_CONNECTION];
                >>+ HV *pnotes;
                >> } modperl_config_con_t;
                >
                >
                > Just a thought, will that work with ITHREADS?

                hmm...

                well, I don't see how it's any different than the same declaration in
                modperl_config_req_t, and my worker tests seemed to pass ok the dozen or so
                times I ran them...

                but I hate threads. test patches that exercise pnotes() (both $c and $r)
                across interpreters most welcome...

                --Geoff
              Your message has been successfully submitted and would be delivered to recipients shortly.