[wildfly-dev] CDI overhead

Stuart Douglas stuart.w.douglas at gmail.com
Mon Jun 30 11:01:26 EDT 2014


Basically the intention is that every EE component can just use @Inject. 
Before EE7 there was not really any standard generally available 
injection mechanism, as CDI was not always present.

Unfortunately because of the way the spec works is is not really 
possible to just look for CDI annotations and make a decision on wether 
to enable it or not, as in theory a deployment with no annotations could 
still look up and use the bean manager from JNDI.

Hopefully the performance impact in 8.1 should be much less noticeable.

Stuart

Andrig Miller wrote:
>
>
> ------------------------------------------------------------------------
>
>     *From: *"Jozef Hartinger" <jharting at redhat.com>
>     *To: *"Andrig Miller" <anmiller at redhat.com>, "wildfly-dev"
>     <wildfly-dev at lists.jboss.org>
>     *Sent: *Monday, June 30, 2014 4:03:59 AM
>     *Subject: *Re: [wildfly-dev] CDI overhead
>
>     I guess that the Weld subsystem is enabled for your deployment
>     because the deployment contains session beans. CDI is required to be
>     enabled for such deployments since CDI 1.1 (even though CDI may not
>     actually be used by your application).
>
> Why is it required, if it will never be used? Is that really what the
> spec says? If so, why in the world would be support that in the spec?
> That simply doesn't make any sense to me. Perhaps I'm missing something
> here.
>
> Andy
>
>     Alternatively to removing the Weld subsystems you can:
>
>     1) Suppress implicit bean archives - only archives with explicit
>     beans.xml file will trigger CDI enablement. See
>     http://weld.cdi-spec.org/documentation/#4
>
>     2) Enable CDI contexts for certain URL subset only:
>     http://docs.jboss.org/weld/reference/2.2.2.Final/en-US/html/configure.html#context.mapping
>
>     Jozef
>
>     On 06/27/2014 06:44 PM, Andrig Miller wrote:
>
>         I should have posted this some time ago, but just forgot.
>
>         In my early testing of Wildfly 8, CDI adds quite a bit of
>         overhead (12% reduction in throughput) for even an application
>         that only uses servlets. The only way I could get that back was
>         to remove the subsystem. In talking with Stuart at the time, he
>         was looking at ways to make the overhead less.
>
>         Is there anything on the docket for making this overhead go away
>         for deployments that don't require CDI? If not, can we get
>         something going in that direction. It would be great to not have
>         to remove the CDI subsystem, but not have it impact performance
>         for deployments that don't use it.
>
>         Thanks.
>
>         --
>         Andrig (Andy) Miller
>         Global Platform Director for JBoss Middle-ware
>         Red Hat, Inc.
>
>
>         _______________________________________________
>         wildfly-dev mailing list
>         wildfly-dev at lists.jboss.org
>         https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
>
>
> _______________________________________________
> wildfly-dev mailing list
> wildfly-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/wildfly-dev


More information about the wildfly-dev mailing list