You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by richardwilko <ri...@gmail.com> on 2008/06/16 15:20:35 UTC

Please check my fix to terracotta problem

Hi,

Just a little background, i've been trying to get my application clustered
with terracotta for a while and ran into a big problem.  Basically wicket
was producing more garbage objects than terracotta could handle, as such
terracotta was using up loads of disk space (see my thread on terracotta
forum for more info http://forums.terracotta.org/forums/posts/list/1144.page
)
To solve this I have decided to try and stop the page object being stored
'as is' to avoid the number of objects being sent to the terracotta server.
My solution has been to replace the default IPageMapEntry with one that only
stores a serialized version of the page:

public class NewPageMapEntry extends AbstractPageMapEntry
{
	private transient Page page;
	private byte[] data;
	
	public NewPageMapEntry(final Page page)
	{
		this.page = page;
		
		data = Objects.objectToByteArray(page);
		
		setNumericId(page.getNumericId());
	}
	
	@Override
	public Page getPage()
	{
		if(this.page == null)
		{
			page = (Page) Objects.byteArrayToObject(data);
		}
		return page;
	}
}

and use it in my base page (which all others extend) like this:

	@Override
	public IPageMapEntry getPageMapEntry()
	{
		return new NewPageMapEntry(this);
	}

Does this seem like a reasonable approach?
-- 
View this message in context: http://www.nabble.com/Please-check-my-fix-to-terracotta-problem-tp17864318p17864318.html
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: Please check my fix to terracotta problem

Posted by Igor Vaynberg <ig...@gmail.com>.
i dont know how terracotta works so i will comment on wicket stuff only.

looks like a good solution if you are looking to compress the page as
far as the number of objects go. a cleaner way to do this might be to
do it in sessionstore and share out that class through terracotta.

-igor

On Mon, Jun 16, 2008 at 6:20 AM, richardwilko
<ri...@gmail.com> wrote:
>
> Hi,
>
> Just a little background, i've been trying to get my application clustered
> with terracotta for a while and ran into a big problem.  Basically wicket
> was producing more garbage objects than terracotta could handle, as such
> terracotta was using up loads of disk space (see my thread on terracotta
> forum for more info http://forums.terracotta.org/forums/posts/list/1144.page
> )
> To solve this I have decided to try and stop the page object being stored
> 'as is' to avoid the number of objects being sent to the terracotta server.
> My solution has been to replace the default IPageMapEntry with one that only
> stores a serialized version of the page:
>
> public class NewPageMapEntry extends AbstractPageMapEntry
> {
>        private transient Page page;
>        private byte[] data;
>
>        public NewPageMapEntry(final Page page)
>        {
>                this.page = page;
>
>                data = Objects.objectToByteArray(page);
>
>                setNumericId(page.getNumericId());
>        }
>
>        @Override
>        public Page getPage()
>        {
>                if(this.page == null)
>                {
>                        page = (Page) Objects.byteArrayToObject(data);
>                }
>                return page;
>        }
> }
>
> and use it in my base page (which all others extend) like this:
>
>        @Override
>        public IPageMapEntry getPageMapEntry()
>        {
>                return new NewPageMapEntry(this);
>        }
>
> Does this seem like a reasonable approach?
> --
> View this message in context: http://www.nabble.com/Please-check-my-fix-to-terracotta-problem-tp17864318p17864318.html
> 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