You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kaspar Fischer <fi...@inf.ethz.ch> on 2009/03/29 18:46:14 UTC

[OT] Book/pointers on caching

I again and again run into the following problem: My Wicket app  
displays a complex page, and in order to compile the information  
needed for this page, I need to do many database/repository queries  
and/or computations -- so many that it simply takes to long and the  
user has two wait.

Take for instance a page with many news blocks for different topics, a  
"recently added content" block, polls, the list of all active users,  
etc. Fetching all this data requires tons of queries to the backend.

I understand that I need some caching mechanism. And as many have  
pointed out on this list, it is preferable to not do this in the  
presentation layer (caching Wicket components) but to move the caching  
to the business logic or persistence layer. So my Wicket models still  
make the same calls, like service.find(blabla), but behind the scenes,  
a cache speeds up the access.

The question is just: what are good caching strategies? When to update  
the cache? Should the cache itself know when to invalidate entries?  
Etc. Is there any sample code, articles, or books on this that you can  
recommend?

I liked to read "Multitiered architectures" in "Wicket in Action" and  
would enjoy something in this direction: Spring, Hibernate (or db4o),  
services, ...

Thanks a lot,
Kaspar

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


Re: [OT] Book/pointers on caching

Posted by nino martinez wael <ni...@gmail.com>.
Lucky I picked that one :)

But seriously it was really simple implementing the cache stuff (with
spring), it's only a few annotations..

2009/3/30 Scott Swank <sc...@gmail.com>:
> This author compared several caching libraries and recommends ehcache.
>
> http://javalandscape.blogspot.com/2009/03/intro-to-cachingcaching-algorithms-and.html
>
> - Scott
>
>
> On Mon, Mar 30, 2009 at 4:33 AM, nino martinez wael
> <ni...@gmail.com> wrote:
>> I wrote something about it here:
>> http://ninomartinez.wordpress.com/2008/08/25/pump-your-java-with-caching/
>>
>> It's very easy if your already using spring or guice or any other IOC framework.
>>
>> One thing though I would'nt cache too much with wicket, the benefit
>> are very small and the code cost are high.
>>
>>
>> 2009/3/29 Kaspar Fischer <fi...@inf.ethz.ch>:
>>> I again and again run into the following problem: My Wicket app displays a
>>> complex page, and in order to compile the information needed for this page,
>>> I need to do many database/repository queries and/or computations -- so many
>>> that it simply takes to long and the user has two wait.
>>>
>>> Take for instance a page with many news blocks for different topics, a
>>> "recently added content" block, polls, the list of all active users, etc.
>>> Fetching all this data requires tons of queries to the backend.
>>>
>>> I understand that I need some caching mechanism. And as many have pointed
>>> out on this list, it is preferable to not do this in the presentation layer
>>> (caching Wicket components) but to move the caching to the business logic or
>>> persistence layer. So my Wicket models still make the same calls, like
>>> service.find(blabla), but behind the scenes, a cache speeds up the access.
>>>
>>> The question is just: what are good caching strategies? When to update the
>>> cache? Should the cache itself know when to invalidate entries? Etc. Is
>>> there any sample code, articles, or books on this that you can recommend?
>>>
>>> I liked to read "Multitiered architectures" in "Wicket in Action" and would
>>> enjoy something in this direction: Spring, Hibernate (or db4o), services,
>>> ...
>>>
>>> Thanks a lot,
>>> Kaspar
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>

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


Re: [OT] Book/pointers on caching

Posted by Scott Swank <sc...@gmail.com>.
This author compared several caching libraries and recommends ehcache.

http://javalandscape.blogspot.com/2009/03/intro-to-cachingcaching-algorithms-and.html

- Scott


On Mon, Mar 30, 2009 at 4:33 AM, nino martinez wael
<ni...@gmail.com> wrote:
> I wrote something about it here:
> http://ninomartinez.wordpress.com/2008/08/25/pump-your-java-with-caching/
>
> It's very easy if your already using spring or guice or any other IOC framework.
>
> One thing though I would'nt cache too much with wicket, the benefit
> are very small and the code cost are high.
>
>
> 2009/3/29 Kaspar Fischer <fi...@inf.ethz.ch>:
>> I again and again run into the following problem: My Wicket app displays a
>> complex page, and in order to compile the information needed for this page,
>> I need to do many database/repository queries and/or computations -- so many
>> that it simply takes to long and the user has two wait.
>>
>> Take for instance a page with many news blocks for different topics, a
>> "recently added content" block, polls, the list of all active users, etc.
>> Fetching all this data requires tons of queries to the backend.
>>
>> I understand that I need some caching mechanism. And as many have pointed
>> out on this list, it is preferable to not do this in the presentation layer
>> (caching Wicket components) but to move the caching to the business logic or
>> persistence layer. So my Wicket models still make the same calls, like
>> service.find(blabla), but behind the scenes, a cache speeds up the access.
>>
>> The question is just: what are good caching strategies? When to update the
>> cache? Should the cache itself know when to invalidate entries? Etc. Is
>> there any sample code, articles, or books on this that you can recommend?
>>
>> I liked to read "Multitiered architectures" in "Wicket in Action" and would
>> enjoy something in this direction: Spring, Hibernate (or db4o), services,
>> ...
>>
>> Thanks a lot,
>> Kaspar
>>
>> ---------------------------------------------------------------------
>> 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: [OT] Book/pointers on caching

Posted by nino martinez wael <ni...@gmail.com>.
I wrote something about it here:
http://ninomartinez.wordpress.com/2008/08/25/pump-your-java-with-caching/

It's very easy if your already using spring or guice or any other IOC framework.

One thing though I would'nt cache too much with wicket, the benefit
are very small and the code cost are high.


2009/3/29 Kaspar Fischer <fi...@inf.ethz.ch>:
> I again and again run into the following problem: My Wicket app displays a
> complex page, and in order to compile the information needed for this page,
> I need to do many database/repository queries and/or computations -- so many
> that it simply takes to long and the user has two wait.
>
> Take for instance a page with many news blocks for different topics, a
> "recently added content" block, polls, the list of all active users, etc.
> Fetching all this data requires tons of queries to the backend.
>
> I understand that I need some caching mechanism. And as many have pointed
> out on this list, it is preferable to not do this in the presentation layer
> (caching Wicket components) but to move the caching to the business logic or
> persistence layer. So my Wicket models still make the same calls, like
> service.find(blabla), but behind the scenes, a cache speeds up the access.
>
> The question is just: what are good caching strategies? When to update the
> cache? Should the cache itself know when to invalidate entries? Etc. Is
> there any sample code, articles, or books on this that you can recommend?
>
> I liked to read "Multitiered architectures" in "Wicket in Action" and would
> enjoy something in this direction: Spring, Hibernate (or db4o), services,
> ...
>
> Thanks a lot,
> Kaspar
>
> ---------------------------------------------------------------------
> 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: [OT] Book/pointers on caching

Posted by James Perry <ja...@gmail.com>.
Caching wicket components is a really bad idea as you will run into
concurrency issues. IMHO the caching strategy depends on the how immutable
the data is, its transaction isolation (read-only, read-write, etc) and what
performance problem you are encountering (Cartesian product, N+1 select,
etc). Have a look at the Java Persistence with Hibernate for a primer on the
subject.

Cheers,
James.

On Sun, Mar 29, 2009 at 5:46 PM, Kaspar Fischer <fi...@inf.ethz.ch>wrote:

> I again and again run into the following problem: My Wicket app displays a
> complex page, and in order to compile the information needed for this page,
> I need to do many database/repository queries and/or computations -- so many
> that it simply takes to long and the user has two wait.
>
> Take for instance a page with many news blocks for different topics, a
> "recently added content" block, polls, the list of all active users, etc.
> Fetching all this data requires tons of queries to the backend.
>
> I understand that I need some caching mechanism. And as many have pointed
> out on this list, it is preferable to not do this in the presentation layer
> (caching Wicket components) but to move the caching to the business logic or
> persistence layer. So my Wicket models still make the same calls, like
> service.find(blabla), but behind the scenes, a cache speeds up the access.
>
> The question is just: what are good caching strategies? When to update the
> cache? Should the cache itself know when to invalidate entries? Etc. Is
> there any sample code, articles, or books on this that you can recommend?
>
> I liked to read "Multitiered architectures" in "Wicket in Action" and would
> enjoy something in this direction: Spring, Hibernate (or db4o), services,
> ...
>
> Thanks a lot,
> Kaspar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>