tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher K. St. John" <>
Subject Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core
Date Wed, 03 Apr 2002 14:45:47 GMT
Arvind Srinivasan wrote:
> I think the performance related change that you made to StandardPipeline can
> be improved upon in that it can avoid using a HashMap to store/retrieve the
> pipeline stage and instead simply store/retrieve it from an integer variable
> in the RequestBase class. Since this codepath (StandardPipeline.invokeNext)
> is executed many times per request, replacing the request.getNote() call
> with something like request.getPipelineStage() will benefit performance.
> I've attached a patch that implements this suggestion.

 The obvious implementation is to have have ValveContext hold
the index.

 That's how I assumed it worked the first time I
saw the Pipeline, Valve and ValveContext classes. I was suprised
to see a ThreadLocal. Using ValveContext has the appropriate
threading semantics, and it avoids hiding the index in a
"mystery attribute" in the Request. And, (although none of this
will result in a measurable performance gain) using 
ValveContext to hold the index should be faster, since it
avoids a hashtable lookup.

 Using a Request note is much like using a global variable:
it's  hidden state. Long term that's bad, for obvious

Christopher St. John

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message