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:
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).
I agree that the current global locking on getInstanceFromFactory method is wrong. I am inclined to remove it completely. I saw your suggested patch and we will discuss this fix/issue more in deep as we don't want to create another regression in other areas related to using factories.
|Retrieving data ...|