You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ian Marshall <Ia...@GMail.com> on 2012/07/13 13:01:02 UTC

Re: Determine session size for Wicket 1.5

Hello,

Is there a good way to discover my serialised or about-to-be-serialised
session size without adding the debug bar to my page?

I currently use

  @Override
  protected void onAfterRender()
  {
    super.onAfterRender();

    CloudSession ssnSession = (CloudSession)getSession();
    long loSize = ssnSession.getSizeInBytes();
    m_logger.log(Level.FINE, String.format("Session size = %,dB.", loSize));
  }

in my WebPage subclass, but I suspect that this is the wrong place to
examine the session size.

My software environment is:

    Web framework: Wicket 1.5.7
    Web server system: Google App Engine for Java version 1.7.0
    Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
    Operating system: Microsoft Windows XP Home Edition version 2002 SP3
(version 5.1 running on x86; Cp1252; en_GB)


Ian Marshall



Walter Rugora wrote
> 
> Thanks Jeremy, works great!!!
> 
> On 23/06/12 23:23, Jeremy Thomerson wrote:
>> On Fri, Jun 22, 2012 at 11:28 PM, Walter Rugora &lt;mist@&gt; wrote:
>> 
>>> Hi,
>>>
>>> when I apply the Wicket 1.3 way to determine session size,
>>> RequestCycle.get().getSession().getSizeInBytes()
>>> it results in an around 3000bytes value in my case. And adding or
>>> removing Labels changed the session size.
>>>
>>> Now with Wicket 1.5 using
>>> Session.get().getSizeInBytes()
>>> session size is 857bytes. And I can add or remove as many Lables as I
>>> wish, that size stays the same. Obviously I use it wrong. Currently I
>>> just add the session size result to a Label added to my single WebPage:
>>> public HomePage(final PageParameters parameters) {
>>>  ...
>>>  add(new Label("ssize",
>>> String.valueOf(Session.get().getSizeInBytes())));
>>>  ...
>>> }
>>>
>> 
>> Here you're doing it in the constructor.  So, if this is the first page
>> you
>> visit there won't be any (Wicket) stuff in the session yet.
>> 
>> Have you tried just adding the debug bar to your page?  Add a dependency
>> to
>> wicket-devutils in your pom.xml and then add(new DebugBar("someID")); to
>> your page (and add it to the markup obviously).
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@.apache
> For additional commands, e-mail: users-help@.apache
> 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650510.html
Sent from the Users forum 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: Determine session size for Wicket 1.5

Posted by Ian Marshall <Ia...@GMail.com>.
Thanks for the tip, Jochen.

I'm already doing that now, using Oracle's Java VisualVM....


Jochen Mader wrote
> 
> Get a heapdump, use yourkit/visualvm.
> 
> On Mon, Jul 16, 2012 at 11:14 AM, Ian Marshall &lt;IanMarshall.UK@&gt;
> wrote:
>> I don't think that I am getting the session size in the right place.
>> Despite
>> my session sizes being logged as very small at ~1.7kB using the Google
>> App
>> Engine (GAE) web development server, in GAE production I am getting
>> session
>> sizes approaching 1MB (and attempting to breach this GAE-imposed limit of
>> 1MB too).
>>
>> I shall have to try and find somewhere else to get a meaningful session
>> size.
>>
>>
>>
>> Ian Marshall wrote
>>>
>>> Thanks Martin,
>>>
>>> I could not find onDetach() but found detach() so I have done this in my
>>> WebSession subclass:
>>>
>>>   @Override
>>>   public void detach()
>>>   {
>>>     long loSize = getSizeInBytes();
>>>     m_logger.log(Level.FINE, String.format("Session size = %,dB.",
>>> loSize));
>>>     super.detach();
>>>   }
>>>
>>> This seems to be fine (my sessions seem very small at ~1.7kB - I must be
>>> doing something wrong) except that this method can be called several
>>> times
>>> as a result of one request.
>>>
>>> Thanks again,
>>>
>>> Ian
>>>
>>>
>>>
>>> Martin Grigorov-4 wrote
>>>>
>>>> Override Session#onDetach() and do it before calling super.onDetach().
>>>>
>>>> On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall &lt;IanMarshall.UK@&gt;
>>>> wrote:
>>>>> Hello,
>>>>>
>>>>> Is there a good way to discover my serialised or
>>>>> about-to-be-serialised
>>>>> session size without adding the debug bar to my page?
>>>>>
>>>>> I currently use
>>>>>
>>>>>   @Override
>>>>>   protected void onAfterRender()
>>>>>   {
>>>>>     super.onAfterRender();
>>>>>
>>>>>     CloudSession ssnSession = (CloudSession)getSession();
>>>>>     long loSize = ssnSession.getSizeInBytes();
>>>>>     m_logger.log(Level.FINE, String.format("Session size = %,dB.",
>>>>> loSize));
>>>>>   }
>>>>>
>>>>> in my WebPage subclass, but I suspect that this is the wrong place to
>>>>> examine the session size.
>>>>>
>>>>> My software environment is:
>>>>>
>>>>>     Web framework: Wicket 1.5.7
>>>>>     Web server system: Google App Engine for Java version 1.7.0
>>>>>     Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
>>>>>     Operating system: Microsoft Windows XP Home Edition version 2002
>>>>> SP3
>>>>> (version 5.1 running on x86; Cp1252; en_GB)
>>>>>
>>>>>
>>>>> Ian Marshall
>>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650543.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@.apache
>> For additional commands, e-mail: users-help@.apache
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@.apache
> For additional commands, e-mail: users-help@.apache

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650569.html
Sent from the Users forum 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: Determine session size for Wicket 1.5

Posted by Jochen Mader <pf...@gmail.com>.
Get a heapdump, use yourkit/visualvm.

On Mon, Jul 16, 2012 at 11:14 AM, Ian Marshall <Ia...@gmail.com> wrote:
> I don't think that I am getting the session size in the right place. Despite
> my session sizes being logged as very small at ~1.7kB using the Google App
> Engine (GAE) web development server, in GAE production I am getting session
> sizes approaching 1MB (and attempting to breach this GAE-imposed limit of
> 1MB too).
>
> I shall have to try and find somewhere else to get a meaningful session
> size.
>
>
>
> Ian Marshall wrote
>>
>> Thanks Martin,
>>
>> I could not find onDetach() but found detach() so I have done this in my
>> WebSession subclass:
>>
>>   @Override
>>   public void detach()
>>   {
>>     long loSize = getSizeInBytes();
>>     m_logger.log(Level.FINE, String.format("Session size = %,dB.",
>> loSize));
>>     super.detach();
>>   }
>>
>> This seems to be fine (my sessions seem very small at ~1.7kB - I must be
>> doing something wrong) except that this method can be called several times
>> as a result of one request.
>>
>> Thanks again,
>>
>> Ian
>>
>>
>>
>> Martin Grigorov-4 wrote
>>>
>>> Override Session#onDetach() and do it before calling super.onDetach().
>>>
>>> On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall &lt;IanMarshall.UK@&gt;
>>> wrote:
>>>> Hello,
>>>>
>>>> Is there a good way to discover my serialised or about-to-be-serialised
>>>> session size without adding the debug bar to my page?
>>>>
>>>> I currently use
>>>>
>>>>   @Override
>>>>   protected void onAfterRender()
>>>>   {
>>>>     super.onAfterRender();
>>>>
>>>>     CloudSession ssnSession = (CloudSession)getSession();
>>>>     long loSize = ssnSession.getSizeInBytes();
>>>>     m_logger.log(Level.FINE, String.format("Session size = %,dB.",
>>>> loSize));
>>>>   }
>>>>
>>>> in my WebPage subclass, but I suspect that this is the wrong place to
>>>> examine the session size.
>>>>
>>>> My software environment is:
>>>>
>>>>     Web framework: Wicket 1.5.7
>>>>     Web server system: Google App Engine for Java version 1.7.0
>>>>     Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
>>>>     Operating system: Microsoft Windows XP Home Edition version 2002 SP3
>>>> (version 5.1 running on x86; Cp1252; en_GB)
>>>>
>>>>
>>>> Ian Marshall
>>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650543.html
> Sent from the Users forum 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: Determine session size for Wicket 1.5

Posted by Ian Marshall <Ia...@GMail.com>.
I don't think that I am getting the session size in the right place. Despite
my session sizes being logged as very small at ~1.7kB using the Google App
Engine (GAE) web development server, in GAE production I am getting session
sizes approaching 1MB (and attempting to breach this GAE-imposed limit of
1MB too).

I shall have to try and find somewhere else to get a meaningful session
size.



Ian Marshall wrote
> 
> Thanks Martin,
> 
> I could not find onDetach() but found detach() so I have done this in my
> WebSession subclass:
> 
>   @Override
>   public void detach()
>   {
>     long loSize = getSizeInBytes();
>     m_logger.log(Level.FINE, String.format("Session size = %,dB.",
> loSize));
>     super.detach();
>   }
> 
> This seems to be fine (my sessions seem very small at ~1.7kB - I must be
> doing something wrong) except that this method can be called several times
> as a result of one request.
> 
> Thanks again,
> 
> Ian
> 
> 
> 
> Martin Grigorov-4 wrote
>> 
>> Override Session#onDetach() and do it before calling super.onDetach().
>> 
>> On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall &lt;IanMarshall.UK@&gt;
>> wrote:
>>> Hello,
>>>
>>> Is there a good way to discover my serialised or about-to-be-serialised
>>> session size without adding the debug bar to my page?
>>>
>>> I currently use
>>>
>>>   @Override
>>>   protected void onAfterRender()
>>>   {
>>>     super.onAfterRender();
>>>
>>>     CloudSession ssnSession = (CloudSession)getSession();
>>>     long loSize = ssnSession.getSizeInBytes();
>>>     m_logger.log(Level.FINE, String.format("Session size = %,dB.",
>>> loSize));
>>>   }
>>>
>>> in my WebPage subclass, but I suspect that this is the wrong place to
>>> examine the session size.
>>>
>>> My software environment is:
>>>
>>>     Web framework: Wicket 1.5.7
>>>     Web server system: Google App Engine for Java version 1.7.0
>>>     Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
>>>     Operating system: Microsoft Windows XP Home Edition version 2002 SP3
>>> (version 5.1 running on x86; Cp1252; en_GB)
>>>
>>>
>>> Ian Marshall
> 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650543.html
Sent from the Users forum 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: Determine session size for Wicket 1.5

Posted by Ian Marshall <Ia...@GMail.com>.
Thanks Martin,

I could not find onDetach() but found detach() so I have done this in my
WebSession subclass:

  @Override
  public void detach()
  {
    long loSize = getSizeInBytes();
    m_logger.log(Level.FINE, String.format("Session size = %,dB.", loSize));
    super.detach();
  }

This seems to be fine (my sessions seem very small at ~1.7kB - I must be
doing something wrong) except that this method can be called several times
as a result of one request.

Thanks again,

Ian



Martin Grigorov-4 wrote
> 
> Override Session#onDetach() and do it before calling super.onDetach().
> 
> On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall &lt;IanMarshall.UK@&gt;
> wrote:
>> Hello,
>>
>> Is there a good way to discover my serialised or about-to-be-serialised
>> session size without adding the debug bar to my page?
>>
>> I currently use
>>
>>   @Override
>>   protected void onAfterRender()
>>   {
>>     super.onAfterRender();
>>
>>     CloudSession ssnSession = (CloudSession)getSession();
>>     long loSize = ssnSession.getSizeInBytes();
>>     m_logger.log(Level.FINE, String.format("Session size = %,dB.",
>> loSize));
>>   }
>>
>> in my WebPage subclass, but I suspect that this is the wrong place to
>> examine the session size.
>>
>> My software environment is:
>>
>>     Web framework: Wicket 1.5.7
>>     Web server system: Google App Engine for Java version 1.7.0
>>     Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
>>     Operating system: Microsoft Windows XP Home Edition version 2002 SP3
>> (version 5.1 running on x86; Cp1252; en_GB)
>>
>>
>> Ian Marshall


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650513.html
Sent from the Users forum 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: Determine session size for Wicket 1.5

Posted by Martin Grigorov <mg...@apache.org>.
Override Session#onDetach() and do it before calling super.onDetach().

On Fri, Jul 13, 2012 at 2:01 PM, Ian Marshall <Ia...@gmail.com> wrote:
> Hello,
>
> Is there a good way to discover my serialised or about-to-be-serialised
> session size without adding the debug bar to my page?
>
> I currently use
>
>   @Override
>   protected void onAfterRender()
>   {
>     super.onAfterRender();
>
>     CloudSession ssnSession = (CloudSession)getSession();
>     long loSize = ssnSession.getSizeInBytes();
>     m_logger.log(Level.FINE, String.format("Session size = %,dB.", loSize));
>   }
>
> in my WebPage subclass, but I suspect that this is the wrong place to
> examine the session size.
>
> My software environment is:
>
>     Web framework: Wicket 1.5.7
>     Web server system: Google App Engine for Java version 1.7.0
>     Java: 1.6.0_33; Java HotSpot(TM) Client VM 20.8-b03
>     Operating system: Microsoft Windows XP Home Edition version 2002 SP3
> (version 5.1 running on x86; Cp1252; en_GB)
>
>
> Ian Marshall
>
>
>
> Walter Rugora wrote
>>
>> Thanks Jeremy, works great!!!
>>
>> On 23/06/12 23:23, Jeremy Thomerson wrote:
>>> On Fri, Jun 22, 2012 at 11:28 PM, Walter Rugora &lt;mist@&gt; wrote:
>>>
>>>> Hi,
>>>>
>>>> when I apply the Wicket 1.3 way to determine session size,
>>>> RequestCycle.get().getSession().getSizeInBytes()
>>>> it results in an around 3000bytes value in my case. And adding or
>>>> removing Labels changed the session size.
>>>>
>>>> Now with Wicket 1.5 using
>>>> Session.get().getSizeInBytes()
>>>> session size is 857bytes. And I can add or remove as many Lables as I
>>>> wish, that size stays the same. Obviously I use it wrong. Currently I
>>>> just add the session size result to a Label added to my single WebPage:
>>>> public HomePage(final PageParameters parameters) {
>>>>  ...
>>>>  add(new Label("ssize",
>>>> String.valueOf(Session.get().getSizeInBytes())));
>>>>  ...
>>>> }
>>>>
>>>
>>> Here you're doing it in the constructor.  So, if this is the first page
>>> you
>>> visit there won't be any (Wicket) stuff in the session yet.
>>>
>>> Have you tried just adding the debug bar to your page?  Add a dependency
>>> to
>>> wicket-devutils in your pom.xml and then add(new DebugBar("someID")); to
>>> your page (and add it to the markup obviously).
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@.apache
>> For additional commands, e-mail: users-help@.apache
>>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Determine-session-size-for-Wicket-1-5-tp4650050p4650510.html
> Sent from the Users forum 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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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