Re: Disable first level cache - session

2021-04-15 Thread Bergmann Manfred
Hello.


> Am 15.04.2021 um 12:56 schrieb Martin Grigorov :
> 
> On Thu, Apr 15, 2021 at 1:31 PM Bergmann Manfred 
> wrote:
> 
>> Hi.
>> 
>> Hmm. Does not seem to remove the session attribute
>> „persistentPageManagerData“, or lower it’s size.
>> It still stores a "org.apache.wicket.page.PageStoreManager$SessionEntry“
>> object which seems to contain a serialized page.
>> It is still quite large. That’s my goal, to remove this session data to
>> keep the session size low.
>> 
>> I have a custom Akka Distributed Data session data store (on Jetty).
>> The first logging is without the „persistentPageManagerData“, manually
>> removed, and put back for the second logging.
>> 
>> DDataSessionDataStore$ - Serializing session...done in 0ms
>> DDataSessionDataStore$ - Session size: 5215
>> DDataSessionDataStore$ - Serializing session...done in 3ms
>> DDataSessionDataStore$ - Session size: 89995
>> 
>> My Application looks like this. I’ve used an AbstractPageStore here
>> because it already does the (de)serialization code needed for the data
>> store.
>> 
>>setPageManagerProvider(new DefaultPageManagerProvider(this) {
>>  override protected def newPageStore(dataStore: IDataStore):
>> IPageStore = {
>>new AbstractPageStore(getFrameworkSettings().getSerializer(),
>> dataStore) {
>>  override def getPage(sessionId: String, pageId: Int):
>> IManageablePage = {
>>deserializePage(getPageData(sessionId, pageId))
>>  }
>>  override def removePage(sessionId: String, pageId: Int): Unit = {
>>removePageData(sessionId, pageId)
>>  }
>>  override def storePage(sessionId: String, page:
>> IManageablePage): Unit = {
>>storePageData(sessionId, page.getPageId, serializePage(page))
>>  }
>>  override def unbind(sessionId: String): Unit = {}
>>  override def canBeAsynchronous(): Boolean = true
>>}
>>  }
>>})
>> 
>> Is it necessary to tweak something in PageStoreManager?
>> 
> 
> Yes, it seems you need to get rid of this method here -
> https://github.com/apache/wicket/blob/53a68caf0b16b6faca07132a7939dedc6184de2f/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java#L498-L502
> 
> Beware that this part of Wicket has been reworked in Wicket 9.x and once
> you make these changes in 8.x you will need to redo them once you upgrade
> to 9.x. Maybe it is a good idea first to migrate to 9.x.
> 

Yep, I know.
In Wicket 9 it is in fact possible to chain the right stores to do that, which 
is pretty nice.
But for now I need a solution for Wicket 8.


Thanks for the help.


> 
>> 
>> 
>> Manfred
>> 
>> 
>>> Am 15.04.2021 um 09:06 schrieb Martin Grigorov :
>>> 
>>> Hi,
>>> 
>>> You need to create a custom IPageManagerProvider.
>>> To make it simpler you can extend from
>>> 
>> https://github.com/apache/wicket/blob/wicket-8.x/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
>>> and override its #newPageStore(IDataStore)
>>> and return an IPageStore that does nothing but delegates to the
>> IDataStore.
>>> 
>>> Then in YourApplication#init() call setPageManagerProvider(yourProvider);
>>> 
>>> On Wed, Apr 14, 2021 at 5:07 PM Bergmann Manfred <
>> m...@software-by-mabe.com>
>>> wrote:
>>> 
 Hi.
 
 Is there a way to disable the first level cache in Wicket 8?
 Reading the documentation this should be the session attribute named:
 „persistentPageManagerData“.
 Since this attribute is written in PageStoreManager (specifically
 PersistentRequestAdapter) I’m not entirely certain how to accomplish
>> that
 in a proper way.
 It would be sufficient for me to run the application from the second
>> level
 cache only.
 
 
 Manfred
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org


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



Re: Disable first level cache - session

2021-04-15 Thread Martin Grigorov
On Thu, Apr 15, 2021 at 1:31 PM Bergmann Manfred 
wrote:

> Hi.
>
> Hmm. Does not seem to remove the session attribute
> „persistentPageManagerData“, or lower it’s size.
> It still stores a "org.apache.wicket.page.PageStoreManager$SessionEntry“
> object which seems to contain a serialized page.
> It is still quite large. That’s my goal, to remove this session data to
> keep the session size low.
>
> I have a custom Akka Distributed Data session data store (on Jetty).
> The first logging is without the „persistentPageManagerData“, manually
> removed, and put back for the second logging.
>
> DDataSessionDataStore$ - Serializing session...done in 0ms
> DDataSessionDataStore$ - Session size: 5215
> DDataSessionDataStore$ - Serializing session...done in 3ms
> DDataSessionDataStore$ - Session size: 89995
>
> My Application looks like this. I’ve used an AbstractPageStore here
> because it already does the (de)serialization code needed for the data
> store.
>
> setPageManagerProvider(new DefaultPageManagerProvider(this) {
>   override protected def newPageStore(dataStore: IDataStore):
> IPageStore = {
> new AbstractPageStore(getFrameworkSettings().getSerializer(),
> dataStore) {
>   override def getPage(sessionId: String, pageId: Int):
> IManageablePage = {
> deserializePage(getPageData(sessionId, pageId))
>   }
>   override def removePage(sessionId: String, pageId: Int): Unit = {
> removePageData(sessionId, pageId)
>   }
>   override def storePage(sessionId: String, page:
> IManageablePage): Unit = {
> storePageData(sessionId, page.getPageId, serializePage(page))
>   }
>   override def unbind(sessionId: String): Unit = {}
>   override def canBeAsynchronous(): Boolean = true
> }
>   }
> })
>
> Is it necessary to tweak something in PageStoreManager?
>

Yes, it seems you need to get rid of this method here -
https://github.com/apache/wicket/blob/53a68caf0b16b6faca07132a7939dedc6184de2f/wicket-core/src/main/java/org/apache/wicket/page/PageStoreManager.java#L498-L502

Beware that this part of Wicket has been reworked in Wicket 9.x and once
you make these changes in 8.x you will need to redo them once you upgrade
to 9.x. Maybe it is a good idea first to migrate to 9.x.


>
>
> Manfred
>
>
> > Am 15.04.2021 um 09:06 schrieb Martin Grigorov :
> >
> > Hi,
> >
> > You need to create a custom IPageManagerProvider.
> > To make it simpler you can extend from
> >
> https://github.com/apache/wicket/blob/wicket-8.x/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
> > and override its #newPageStore(IDataStore)
> > and return an IPageStore that does nothing but delegates to the
> IDataStore.
> >
> > Then in YourApplication#init() call setPageManagerProvider(yourProvider);
> >
> > On Wed, Apr 14, 2021 at 5:07 PM Bergmann Manfred <
> m...@software-by-mabe.com>
> > wrote:
> >
> >> Hi.
> >>
> >> Is there a way to disable the first level cache in Wicket 8?
> >> Reading the documentation this should be the session attribute named:
> >> „persistentPageManagerData“.
> >> Since this attribute is written in PageStoreManager (specifically
> >> PersistentRequestAdapter) I’m not entirely certain how to accomplish
> that
> >> in a proper way.
> >> It would be sufficient for me to run the application from the second
> level
> >> cache only.
> >>
> >>
> >> Manfred
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Disable first level cache - session

2021-04-15 Thread Bergmann Manfred
Hi.

Hmm. Does not seem to remove the session attribute „persistentPageManagerData“, 
or lower it’s size.
It still stores a "org.apache.wicket.page.PageStoreManager$SessionEntry“ object 
which seems to contain a serialized page.
It is still quite large. That’s my goal, to remove this session data to keep 
the session size low.

I have a custom Akka Distributed Data session data store (on Jetty).
The first logging is without the „persistentPageManagerData“, manually removed, 
and put back for the second logging.

DDataSessionDataStore$ - Serializing session...done in 0ms
DDataSessionDataStore$ - Session size: 5215
DDataSessionDataStore$ - Serializing session...done in 3ms
DDataSessionDataStore$ - Session size: 89995

My Application looks like this. I’ve used an AbstractPageStore here because it 
already does the (de)serialization code needed for the data store.

setPageManagerProvider(new DefaultPageManagerProvider(this) {
  override protected def newPageStore(dataStore: IDataStore): IPageStore = {
new AbstractPageStore(getFrameworkSettings().getSerializer(), 
dataStore) {
  override def getPage(sessionId: String, pageId: Int): IManageablePage 
= {
deserializePage(getPageData(sessionId, pageId))
  }
  override def removePage(sessionId: String, pageId: Int): Unit = {
removePageData(sessionId, pageId)
  }
  override def storePage(sessionId: String, page: IManageablePage): 
Unit = {
storePageData(sessionId, page.getPageId, serializePage(page))
  }
  override def unbind(sessionId: String): Unit = {}
  override def canBeAsynchronous(): Boolean = true
}
  }
})

Is it necessary to tweak something in PageStoreManager?


Manfred


> Am 15.04.2021 um 09:06 schrieb Martin Grigorov :
> 
> Hi,
> 
> You need to create a custom IPageManagerProvider.
> To make it simpler you can extend from
> https://github.com/apache/wicket/blob/wicket-8.x/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
> and override its #newPageStore(IDataStore)
> and return an IPageStore that does nothing but delegates to the IDataStore.
> 
> Then in YourApplication#init() call setPageManagerProvider(yourProvider);
> 
> On Wed, Apr 14, 2021 at 5:07 PM Bergmann Manfred 
> wrote:
> 
>> Hi.
>> 
>> Is there a way to disable the first level cache in Wicket 8?
>> Reading the documentation this should be the session attribute named:
>> „persistentPageManagerData“.
>> Since this attribute is written in PageStoreManager (specifically
>> PersistentRequestAdapter) I’m not entirely certain how to accomplish that
>> in a proper way.
>> It would be sufficient for me to run the application from the second level
>> cache only.
>> 
>> 
>> Manfred
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 


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



Re: Disable first level cache - session

2021-04-15 Thread Martin Grigorov
Hi,

You need to create a custom IPageManagerProvider.
To make it simpler you can extend from
https://github.com/apache/wicket/blob/wicket-8.x/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java
and override its #newPageStore(IDataStore)
and return an IPageStore that does nothing but delegates to the IDataStore.

Then in YourApplication#init() call setPageManagerProvider(yourProvider);

On Wed, Apr 14, 2021 at 5:07 PM Bergmann Manfred 
wrote:

> Hi.
>
> Is there a way to disable the first level cache in Wicket 8?
> Reading the documentation this should be the session attribute named:
> „persistentPageManagerData“.
> Since this attribute is written in PageStoreManager (specifically
> PersistentRequestAdapter) I’m not entirely certain how to accomplish that
> in a proper way.
> It would be sufficient for me to run the application from the second level
> cache only.
>
>
> Manfred
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>