-
Dec 3rd, 2010, 06:58 AM
#1
Problems with SerializedFlowExecutionSnapshotFactory
We recently ran into some performance problems in our WebFlow2.2 + JSF2 application.
The problem is that we have a large (singleton scoped)cache, it contains about 200k strings, that is injected into a flowscoped bean.
So when the flowscoped bean gets serialized (this is done once for every request) the cache gets dragged into the serialization.
Making the reference to the cache transient in the flowscoped bean doesn't really work because we'll loose the reference to our cache every time the bean is deserialized and it doesn't seem spring re injects it after deserialization.
What is the best practice to handle a situation like this?
The solutions i have thought of is to a) turn the cache into an actual singleton, b) modify SerializedFlowExecutionSnapshotFactory to exclude singleton scoped beans from the serialization process.
I have a temporary fix in place where i have made the data in the cache transient and i reseed the cache every time its used, this way only calls that use the cache is affected(it defeats the purpose of the cache somewhat tho).
Thanks.
-
Dec 3rd, 2010, 05:38 PM
#2
The best solution I've found so far is not to inject the actual spring bean, but rather inject the name of the bean for lookup when it's needed. The bean with your cache will remain singleton scoped, and will be looked up each time it's needed.
Refer to this thread (and the thread linked from there) for how to do this.
-
Dec 3rd, 2010, 07:22 PM
#3
Thanks!
That solution is pretty much exactly what i needed, and its probably the one i will use in our project.
It would be nicer to fix the serialization tho, but i don't know how much work it is to swap out the SnapshotFactory so ill probably just wait for a better fix in the future
Last edited by Hjalmare; Dec 3rd, 2010 at 07:30 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules