Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15671

Performance overhead of bean post processor when using camel spring on bootstrap

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.25.0
    • 3.6.0
    • camel-spring
    • None
    • Unknown

    Description

      We are using the http://camel.apache.org/schema/spring namespace to configure a Camel context from spring.

      It seems that CamelNamespaceHandler.CamelContextBeanDefinitionParser#doParse unconditionally registers a CamelBeanPostProcessor into the underlying Spring ApplicationContext: there is no guard or configuration option to prevent the execution of CamelNamespaceHandler#injectBeanPostProcessor.

      This is unfortunate, since we are not using any of the Camel annotations in the beans present in the Spring application context of our application. At the same time, CamelBeanPostProcessor introduces dramatic runtime performance overhead.

      Specifically, any bean initialized and configured by the Spring application context will be inspected by the camel bena post processor for presence of Camel annotations. In our use-case, Spring @Configurable annotated entities are used, which can have bean creation rates of tens of thousands per second. Without the CamelBeanPostProcessor present, the performance impact of this is negligible. With the CamelBeanPostProcessor present, this introduces significant bottlenecks.

      See below for the relevant parts of the Camel annotation scanning code dominating this bottleneck (from a JFR recording).

      The use of the Spring Camel namespace seems to be conflated with the unconditional injection of the CamelBeanPostProcessor, with no configuration or strategy specialization option to separate these.

      For users using the namespace, but not using the Camel annotations, it would be very useful to have control over this aspect of Camel/Spring integration.

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            taras.tielkes Taras Tielkes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment