You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Doug Leeper <do...@yahoo.com> on 2007/11/01 18:10:07 UTC

Best practice question

I believe I may be doing somethings incorrect in my application because I
just ran across an OutOfMemoryError and the steps involved were small.

I did increase the memory size to -Xms256m -Xmx512m which got me past the
original issue...but I did notice that the application heap size continues
to grow more than I thought it should.  In other words, my app won't scale
when I add more users beyond me :-|

Where I think I am causing problems in my memory management is that I am
passing Page references around.  I do this so I can place a "Cancel" button
and go back to the previous page rather than relying on the browser back
button.

Is this the wrong approach?  If so, what should I do to achieve this
behavior? or should I just remove the "Cancel" button and rely on the
browser back button?

Also, I don't "clean" anything up at all, i.e. pages.  Should I?  If so,
when? and how?

Thanks
- Doug
-- 
View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13533032
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice question

Posted by James McLaughlin <jo...@gmail.com>.
Hi Doug,
It is hard to say without knowing more about your app. As a rule, I
never keep references to data in my components. Components have only
refs to services (injectable) and all the data are encapsulated by
IModels of one sort  or another. The IModels always implement
IDetachable and keep only the minumum of info necessary to rehydrate
the data. Usually, LoadableDetachableModel provides all the
functionality I need. Check to make sure you have followed these rules
of thumb. You should be ok if you have.

best,
jim

On 11/1/07, Doug Leeper <do...@yahoo.com> wrote:
>
> That is good that you do the same thing...so it must be my implementation
> that is wrong.  I use an optimizer to find the issue.  Do you recommend a
> reasonable one?
>
> Also, is it possible to introspect the serialized data?
>
> Also, I am using Hibernate.  Would classes obtained via Hibernate that are
> local objects to a page be a problem?
> --
> View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13534427
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice question

Posted by Doug Leeper <do...@yahoo.com>.
I forgot to add this value was after a forced GC.

The value before GC was 88%/118MB.

Does anything look out of ordinary from your viewpoint?
-- 
View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13537001
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice question

Posted by Doug Leeper <do...@yahoo.com>.
I am using Jdk1.5 and Wicket 1.3/Trunk (from earlier this week)

I just downloaded and installed YourKit.

I stepped through my application and took snapshots.

The bulk of the memory is in byte[].  Traversing the graph where this is
located is in the
org.apache.wicket.protocol.http.pagestore.DiskPageStore$SerializedPageWithSession
(75% of memory/~26MB of total heap)

This not only with a small number of pages
Home Page
Login Page
User Page
Building Page
Select Tab
NewAssetPage
   - SelectCategory
   - SelectModel
   - Info
   - Confirm
   - ModalWindow
Back to Building Page

The heap really jumps when I use Ajax.

Any idea what else I need to look at.  I can't go beyond DiskPageStore
because it says "Objects are retained by instances of several classes"

I have included an image of the snapshot.

http://www.nabble.com/file/p13536655/wicket-profle-snapshot.gif 


-- 
View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13536655
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice question

Posted by Matej Knopp <ma...@gmail.com>.
Yourkit really works pretty darn well.
Btw. What wicket version are you using? And are you sure it's Wicket /
Web that is leaking?

-Matej

On 11/1/07, Igor Vaynberg <ig...@gmail.com> wrote:
> i use yourkit, it seems to work pretty darn well
>
> -igor
>
>
> On 11/1/07, Doug Leeper <do...@yahoo.com> wrote:
> >
> > That is good that you do the same thing...so it must be my implementation
> > that is wrong.  I use an optimizer to find the issue.  Do you recommend a
> > reasonable one?
> >
> > Also, is it possible to introspect the serialized data?
> >
> > Also, I am using Hibernate.  Would classes obtained via Hibernate that are
> > local objects to a page be a problem?
> > --
> > View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13534427
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice question

Posted by Igor Vaynberg <ig...@gmail.com>.
i use yourkit, it seems to work pretty darn well

-igor


On 11/1/07, Doug Leeper <do...@yahoo.com> wrote:
>
> That is good that you do the same thing...so it must be my implementation
> that is wrong.  I use an optimizer to find the issue.  Do you recommend a
> reasonable one?
>
> Also, is it possible to introspect the serialized data?
>
> Also, I am using Hibernate.  Would classes obtained via Hibernate that are
> local objects to a page be a problem?
> --
> View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13534427
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice question

Posted by Doug Leeper <do...@yahoo.com>.
That is good that you do the same thing...so it must be my implementation
that is wrong.  I use an optimizer to find the issue.  Do you recommend a
reasonable one?

Also, is it possible to introspect the serialized data?

Also, I am using Hibernate.  Would classes obtained via Hibernate that are
local objects to a page be a problem?
-- 
View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13534427
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best practice question

Posted by Igor Vaynberg <ig...@gmail.com>.
i do the same thing all over the place and no memory issues here, so
look for something else or use a profiler to see exactly what you are
leaking

-igor


On 11/1/07, Doug Leeper <do...@yahoo.com> wrote:
>
> I believe I may be doing somethings incorrect in my application because I
> just ran across an OutOfMemoryError and the steps involved were small.
>
> I did increase the memory size to -Xms256m -Xmx512m which got me past the
> original issue...but I did notice that the application heap size continues
> to grow more than I thought it should.  In other words, my app won't scale
> when I add more users beyond me :-|
>
> Where I think I am causing problems in my memory management is that I am
> passing Page references around.  I do this so I can place a "Cancel" button
> and go back to the previous page rather than relying on the browser back
> button.
>
> Is this the wrong approach?  If so, what should I do to achieve this
> behavior? or should I just remove the "Cancel" button and rely on the
> browser back button?
>
> Also, I don't "clean" anything up at all, i.e. pages.  Should I?  If so,
> when? and how?
>
> Thanks
> - Doug
> --
> View this message in context: http://www.nabble.com/Best-practice-question-tf4732767.html#a13533032
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org