In my opinion, soft referencing page objects is highly appropriate usage
here. If there's pressure on the available memory, it makes sense to trade
performance for memory instead of exiting with OoM. This is simple
condition to detect and should be visible with any reasonable monitoring
tool. If you are hitting memory limits, you'll need to allocate more memory
for the application for optimal performance. Soft references are especially
useful here because you can optimize its behavior with the -client/-server
setting depending on your preferences.

Kalle

On Tue, Mar 17, 2015 at 4:26 PM, Howard Lewis Ship <hls...@gmail.com> wrote:

> Possibly we need something more advanced; our own reference type that can
> react to memory pressure by discarding pages that haven't been used in
> configurable amount of time.
>
> Or perhaps we could just assume that any page that has been used once need
> to be used in the future and get rid of the SoftReference entirely (or
> otherwise janitorize it in some way).
>
> On Tue, Mar 17, 2015 at 1:24 AM, Robert Schmelzer <rob...@schmelzer.cc>
> wrote:
>
> > Hello,
> >
> > I recently came accross the implementation of PageSourceImpl where
> > PageImpl instances are softly refereneced into the pageCache:
> >
> > private final Map<CachedPageKey, SoftReference<Page>> pageCache =
> > CollectionFactory.newConcurrentMap();
> >
> > This implementation caused troubles, when you bring your system into
> > memory preassure. The JVM will start to throw away the PageImpl to free
> up
> > memory - but during request processing he needs the PageImpl again and
> > starts creating it again. So basically you end up loosing your pageCache
> at
> > all and start creating the PageImpl instances on every request, which
> take
> > way to much time and takes load onto the CPU. So basically you are
> hiding a
> > memory problem by making the system slow and raise CPU load.
> >
> > I would suggest to use "normal" references for the PageCache or at least
> > only do SoftReferences only when not in production mode. Otherwise we are
> > going to cover memory problems for too long.
> >
> > What do you think about that?
> >
> > Robert
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
> @hlship
>

Reply via email to