Adriano Machado created CAMEL-26475:
---------------------------------------

             Summary: camel-management - one nanoTime per node for the 
processor statistics
                 Key: CAMEL-26475
                 URL: https://issues.apache.org/jira/browse/CAMEL-26475
             Project: Camel
          Issue Type: Sub-task
            Reporter: Adriano Machado
            Assignee: Adriano Machado
             Fix For: 4.24.0


Item \(c\) of the JMX statistics section of CAMEL\-25132. With the default 
statistics level, each node reads {{nanoTime}} twice. Measured on JDK 21 Linux, 
single threaded, on a 10 node route that does nothing: 545k exchanges per 
second, 690k without {{nanoTime}}, and 695k without {{nanoTime}} and without 
the {{StopWatch}} allocation, so the cost is the clock reads and not the 
allocation.

A prototype that reuses the end time of the previous node as the start of the 
next node reached 603k \(\+10.6%\), about 175 ns per exchange on that route. 
The saving per exchange is fixed, so it is small on a route that does real 
work. It costs 8 bytes on every exchange, also without JMX, and an addition to 
{{ExchangeExtension}}. This will be a draft pull request so that the tradeoff 
can be decided in review.

A reused time must never be stale: a route reads a fresh time, and a failure or 
a node without statistics clears it.

_Claude Code on behalf of Adriano Machado \(@ammachado\)_

_This was generated by an AI agent and may contain inaccuracies. Please verify 
before relying on it._





--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to