Hi all!  I recently submitted 8 enhancement tickets via Bugzilla, all related 
to JSP performance, and I thought an explanation would be helpful.

  In early September, I received an internal report that a small EL change 
created a 40ms latency regression on the affected calls.  The original EL 
expression was already complex, and the change added a relatively simple clause 
at the end of a series of "&&" .  On the face of it, the data wasn't rational, 
and I was deeply skeptical.

  However, research into the execution of that statement identified a number of 
Tomcat hotspots, many of which are fixable with isolated changes - thus most of 
the tickets.  One or two are less isolated and deserve more caution.

  I asked the change implementer to simplify the EL statement by moving much of 
the logic into Java; this reached production on Monday and we confirmed this 
eliminated the 40ms regression.
  I can't adequately explain how this change reached 40ms of impact, but my 
best theory is that our allocation-heavy application was pushed over a 
threshold by the EL's burst of extra allocation.  That threshold may be TLAB, 
or contention on a JVM-internal lock, or something else I haven't thought of.  
I welcome any other possible explanations.

  Relevant tickets are:
https://bz.apache.org/bugzilla/show_bug.cgi?id=69338 - parsing optimization 
when turning EL -> AST nodes (resolved)
https://bz.apache.org/bugzilla/show_bug.cgi?id=69348 - allocation reduction in 
ELParser (resolved)
https://bz.apache.org/bugzilla/show_bug.cgi?id=69377 - JSP work reduction, 
large scope (pending)
https://bz.apache.org/bugzilla/show_bug.cgi?id=69381 - allocation reduction 
when executing reflecting expressions, i.e. "bean.myMethod()" (PR submitted)
https://bz.apache.org/bugzilla/show_bug.cgi?id=69382 - performance optimization 
to generated code for <jsp:param> (patch submitted)
https://bz.apache.org/bugzilla/show_bug.cgi?id=69398 - allocation reduction in 
BodyContentImpl (pending)
https://bz.apache.org/bugzilla/show_bug.cgi?id=69406 - bug fix that enables 
existing enum optimizations in one of our applications (pending)
https://bz.apache.org/bugzilla/show_bug.cgi?id=69419 - performance optimization 
to ApplicationHttpRequest (patch submitted)

  The most impactful of the pending tickets is #69381 (reflective expressions), 
which removes object allocation that scales per method on a bean.  I plan to 
add patches or PRs to the remaining issues in the next couple of weeks.

  Thanks everyone for their help and attention - and again, I welcome any 
theories about how the change reached 40ms of impact.
     John

Reply via email to