It can’t rain forever…

July 31, 2006

Struggling with Struts

Filed under: Java — bbossola @ 9:21 pm

Today I was looking at session size of one webapp: it was increasing while using application functions…. 50k, 60k, 70k, 80k… wtf? I know programmers were warned about inserting data into the session, cleaning the stuff after using it, so what? Well, the reason is that if you don’t decide else Struts 1 will put all your forms inside your session! I couldn’t believe it!

Let’s go reading the official documentation… Struts guys gently suggest: “…as a general rule, allocating scarce resources and keeping them across requests from the same user (in the user’s session) can cause scalability problems…”
Well, good rule of thumb! We do know about this!

But, some paragraph after, the deadly note: “…an ActionForm represents an HTML form that the user interacts… ActionForms can be stored in either the session (default) or request scope…”

WHAT? You guys really said that forms are stored in the session by default???

I don’t know what to say… sadly in the next days a development group will be analyzing one by one our 640 usecases and 1465 form, just to ensure that moving them to request scope (oh, yeah, you also have to modify line by line your xml config) will keep the field clear.

I know, ignorance is not an excuse, but now I understand why struts 1.x is over, and why struts 2.x ISA webwork :-)

P.S.
Domenico, a friend of mine and expert programmer, pointed me out this bad trick… thanks! I’ll use it as last resource.

1 Comment »

  1. Obviously, we used that bad trick :-(

    Comment by Bruno — August 31, 2006 @ 3:47 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.