Management of page session map

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Management of page session map

geoffaj

On a production application using DWR 2.0.9, I noticed that the number of entries in DefaultScriptSessionManager's pageSessionMap increases forever. This application's use of Spring Webflow 1.0.4 (old!), causes it to continually generate new unique URLs, each time a flow is entered by a user. As a result, I'm seeing tens of thousands of entries in pageSessionMap, which appears to degrade performance. In a 'normal' app, I'd expect the number of unique URLs for an app to be fairly limited. Here's an example of the created URLs:
https://localhost/myapp/flow/k/_c6F312258-F407-3BDF-5B73-17E4C5A92C3E_kE1D31343-C3A5-EAB1-B429-9CF977225DA4     
https://localhost/myapp/flow/k/_c4AEBE1D6-D0F9-5951-40F4-CE82FB8B76E9_kF8BEFBCB-3B39-6CD5-40FF-6E864E78F4A3

The unique flow ID isn't part of the query string, so it's not stripped by PageNormalizer.normalizePage.

I may be misreading the code, but I see no means by which entries are ever removed from this map.

Locally, I've tested a change to DefaultScriptSessionManager.invalidate that removes the pageSessionMap entry, if the number of pageSessions is zero.

Some questions:
-Does this seem like a reasonable approach to managing the sizer of pageSessionMap?
-Is it intentional that pageSessionMap should be allowed to grow indefinitely?
-In 3.0RC2, would the same behavior be expected? (DefaultScriptSessionManager seems to have changed substantially) 

Apologies in advance if this has been discussed before - my searches of the mailing list and JIRA came up with nothing, but it's entirely possible I missed it. I've posted to the dev list since this mostly pertains to DWR internals.

Geoff






Reply | Threaded
Open this post in threaded view
|

Re: Management of page session map

Mike Wilson
Administrator
Hi Geoff, 
 
and thanks for reporting this discovery. No, there is no need to keep paths that have no active scriptsession, so we should certainly clean this collection as you suggest. Let's continue the discussion about the right fix in the ticket you created (http://bugs.directwebremoting.org/bugs/browse/DWR-581). I'll get back to you about 3.0RC2 behaviour after looking a bit more.
 
Best regards
Mike Wilson 
 
Geoff Johnston wrote:
On a production application using DWR 2.0.9, I noticed that the number of entries in DefaultScriptSessionManager's pageSessionMap increases forever. This application's use of Spring Webflow 1.0.4 (old!), causes it to continually generate new unique URLs, each time a flow is entered by a user. As a result, I'm seeing tens of thousands of entries in pageSessionMap, which appears to degrade performance. In a 'normal' app, I'd expect the number of unique URLs for an app to be fairly limited. Here's an example of the created URLs:
https://localhost/myapp/flow/k/_c6F312258-F407-3BDF-5B73-17E4C5A92C3E_kE1D31343-C3A5-EAB1-B429-9CF977225DA4
https://localhost/myapp/flow/k/_c4AEBE1D6-D0F9-5951-40F4-CE82FB8B76E9_kF8BEFBCB-3B39-6CD5-40FF-6E864E78F4A3

The unique flow ID isn't part of the query string, so it's not stripped by PageNormalizer.normalizePage.

I may be misreading the code, but I see no means by which entries are ever removed from this map.

Locally, I've tested a change to DefaultScriptSessionManager.invalidate that removes the pageSessionMap entry, if the number of pageSessions is zero.

Some questions:
-Does this seem like a reasonable approach to managing the sizer of pageSessionMap?
-Is it intentional that pageSessionMap should be allowed to grow indefinitely?
-In 3.0RC2, would the same behavior be expected? (DefaultScriptSessionManager seems to have changed substantially)

Apologies in advance if this has been discussed before - my searches of the mailing list and JIRA came up with nothing, but it's entirely possible I missed it. I've posted to the dev list since this mostly pertains to DWR internals.

Geoff
Reply | Threaded
Open this post in threaded view
|

Re: Management of page session map

Mike Wilson
Administrator
David had already determined that it also affects 3.0RC2, including his mail below:
Geoff, thanks for the clarification and for looking into this so thoroughly - I see what you are talking about. Can you do me a favor and create a JIRA ticket for this (only one ticket is necessary but it affects both 2.x and 3.x)? Until we fix this you may want to extend DefaultScriptSessionManager and override the invalidate method to be a bit smarter with the clean-up. You can then plugin your custom ScriptSessionManager via our instructions here - http://directwebremoting.org/dwr/documentation/server/configuration/servlet/plugin.html.
Mike Wilson wrote:
Hi Geoff, 
 
and thanks for reporting this discovery. No, there is no need to keep paths that have no active scriptsession, so we should certainly clean this collection as you suggest. Let's continue the discussion about the right fix in the ticket you created (http://bugs.directwebremoting.org/bugs/browse/DWR-581). I'll get back to you about 3.0RC2 behaviour after looking a bit more.
 
Best regards
Mike Wilson 
 
Geoff Johnston wrote:
On a production application using DWR 2.0.9, I noticed that the number of entries in DefaultScriptSessionManager's pageSessionMap increases forever. This application's use of Spring Webflow 1.0.4 (old!), causes it to continually generate new unique URLs, each time a flow is entered by a user. As a result, I'm seeing tens of thousands of entries in pageSessionMap, which appears to degrade performance. In a 'normal' app, I'd expect the number of unique URLs for an app to be fairly limited. Here's an example of the created URLs:
https://localhost/myapp/flow/k/_c6F312258-F407-3BDF-5B73-17E4C5A92C3E_kE1D31343-C3A5-EAB1-B429-9CF977225DA4
https://localhost/myapp/flow/k/_c4AEBE1D6-D0F9-5951-40F4-CE82FB8B76E9_kF8BEFBCB-3B39-6CD5-40FF-6E864E78F4A3

The unique flow ID isn't part of the query string, so it's not stripped by PageNormalizer.normalizePage.

I may be misreading the code, but I see no means by which entries are ever removed from this map.

Locally, I've tested a change to DefaultScriptSessionManager.invalidate that removes the pageSessionMap entry, if the number of pageSessions is zero.

Some questions:
-Does this seem like a reasonable approach to managing the sizer of pageSessionMap?
-Is it intentional that pageSessionMap should be allowed to grow indefinitely?
-In 3.0RC2, would the same behavior be expected? (DefaultScriptSessionManager seems to have changed substantially)

Apologies in advance if this has been discussed before - my searches of the mailing list and JIRA came up with nothing, but it's entirely possible I missed it. I've posted to the dev list since this mostly pertains to DWR internals.

Geoff
Reply | Threaded
Open this post in threaded view
|

Re: Management of page session map

david@butterdev.com
Thanks Mike.

On Wed, Aug 1, 2012 at 2:33 AM, Mike Wilson <[hidden email]> wrote:
David had already determined that it also affects 3.0RC2, including his mail below:
Geoff, thanks for the clarification and for looking into this so thoroughly - I see what you are talking about. Can you do me a favor and create a JIRA ticket for this (only one ticket is necessary but it affects both 2.x and 3.x)? Until we fix this you may want to extend DefaultScriptSessionManager and override the invalidate method to be a bit smarter with the clean-up. You can then plugin your custom ScriptSessionManager via our instructions here - http://directwebremoting.org/dwr/documentation/server/configuration/servlet/plugin.html.
Mike Wilson wrote:
Hi Geoff, 
 
and thanks for reporting this discovery. No, there is no need to keep paths that have no active scriptsession, so we should certainly clean this collection as you suggest. Let's continue the discussion about the right fix in the ticket you created (http://bugs.directwebremoting.org/bugs/browse/DWR-581). I'll get back to you about 3.0RC2 behaviour after looking a bit more.
 
Best regards
Mike Wilson 
 
Geoff Johnston wrote:
On a production application using DWR 2.0.9, I noticed that the number of entries in DefaultScriptSessionManager's pageSessionMap increases forever. This application's use of Spring Webflow 1.0.4 (old!), causes it to continually generate new unique URLs, each time a flow is entered by a user. As a result, I'm seeing tens of thousands of entries in pageSessionMap, which appears to degrade performance. In a 'normal' app, I'd expect the number of unique URLs for an app to be fairly limited. Here's an example of the created URLs:
The unique flow ID isn't part of the query string, so it's not stripped by PageNormalizer.normalizePage.

I may be misreading the code, but I see no means by which entries are ever removed from this map.

Locally, I've tested a change to DefaultScriptSessionManager.invalidate that removes the pageSessionMap entry, if the number of pageSessions is zero.

Some questions:
-Does this seem like a reasonable approach to managing the sizer of pageSessionMap?
-Is it intentional that pageSessionMap should be allowed to grow indefinitely?
-In 3.0RC2, would the same behavior be expected? (DefaultScriptSessionManager seems to have changed substantially)

Apologies in advance if this has been discussed before - my searches of the mailing list and JIRA came up with nothing, but it's entirely possible I missed it. I've posted to the dev list since this mostly pertains to DWR internals.

Geoff