2 Replies Latest reply on Jul 3, 2012 6:59 AM by manarh

    Global factoryLock in Component.java - performance issue

    ahus1

      Hi,


      I have been analyzing our application in a multiuser environment, and I found an issue whenever new bean instances are created by a factory in Component.java.


      There is actually an application wide lock (factoryLock) whenever new instances are created by a factory. As my factory is using backend calls to initialize these factories, and this lock enforces this to be sequentially, this has a big performance impact.


      I looked behind the scenes and found there are multiple scenarios where you don't need to lock at all, especially when the outcome will be CONVERSATION/PAGE/EVENT scoped, the factory is CONVERSATION/PAGE/EVENT scoped, and if the factory is not using injection at all.


      After that it would also be a lot more efficient to lock on the single factory instance, instead of using one global lock.


      We deployed the first part of the change to our production environment (only lock when necessary) and found a big performance boost. The second change (one lock per factory if needed) is currently in test.


      Please have a look here for the patch:


      JBSEAM-4861


      and comment - and vote to have this included.


      Even if you don't have your own expensive factory calls, there are a lot of factory calls in the seam core, i.e. each instance of messages is created in the event scope for every call (although it is one of the fast ones).


      Best regards,
      Alexander.