Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Michael Bosworth
page caching when signed in?
May 12, 2008 1:16 PM
Answer

Michael Bosworth

Rank: New Member

Posts: 24

Join Date: May 22, 2006

Recent Posts

I've searched the wiki and the forums for this but cannot find it anywhere.

When logged out as guest, if every portlet on a page is layout-cacheable, the page caches.

When logged in, even if every portlet on a page is layout-cacheable, the page does not cache.

Due to lack of caching we are experiencing ridiculous performance problems to the point that the portal is almost unusable from certain locations.

How do you make pages cache when logged in?

ANYthing that ANYone knows, at all, would be much appreciated.

Thanks
Michael Bosworth
RE: page caching when signed in?
May 13, 2008 6:16 AM
Answer

Michael Bosworth

Rank: New Member

Posts: 24

Join Date: May 22, 2006

Recent Posts

*bump*
Michael Bosworth
RE: page caching when signed in?
May 16, 2008 7:16 AM
Answer

Michael Bosworth

Rank: New Member

Posts: 24

Join Date: May 22, 2006

Recent Posts

come on guys, someone must have some idea about this. i don't mean to be pushy but we are dealing with serious lags here and i don't even know where to start looking.

one other thing - the landing page (/web/guest/default) whether logged in or logged out never caches. regardless of the portlets on it and regardless of the theme.

now i'm inheriting this portal from someone else and from people who aren't here anymore but did a lot of work on it in my absence since i installed it two years ago. i don't know what settings they may have changed or if they did anything to affect caching.

anyone have a clue where i should start looking? i'd really appreciate it. emoticon

thanks!

mb
James Min
RE: page caching when signed in?
May 16, 2008 7:50 AM
Answer

James Min

LIFERAY STAFF

Rank: Expert

Posts: 293

Join Date: August 14, 2006

Recent Posts

What version of Liferay? JDK version? OS? Tomcat or another app server?

What did you do to pinpoint the bottleneck? Did you use a Java profiler (Jprofiler, YourKit, etc) or see any errors in the log?

It could be a combination of things, but Liferay can be tuned to be much more responsive. Can you include more data on what you found?
Michael Bosworth
RE: page caching when signed in?
May 16, 2008 9:12 AM
Answer

Michael Bosworth

Rank: New Member

Posts: 24

Join Date: May 22, 2006

Recent Posts

I am using the Jboss-Tomcat server 4.04GA with Liferay Portal Enterprise 4.1.1 served on a unix machine.

Using ab (apache's page loading test program), when I hit a page twice in a row it loads in about 2.x seconds the first time and then 0.003 seconds the second time IF every portlet on the page is layout-cacheable. I've also set their expiration-cache values to 999999.

I have also noticed something else which confirms the suspicion I had that the pages weren't caching:

Adding a System.out.println to top.jsp in the theme's templates directory allows me to see when the page is generated on the fly and when it is sent from the cache. On the fly, I see a "hello world," whereas when it is cached, I see nothing at all.

I have confirmed that the same page that does not cache when logged in does cache when logged out, because of this print line trick.

The slow down is because it's generating pages that should be cached and spat out as last rendered. I do not mind for now that the rendering takes so long (2+ seconds) IF I can get certain pages that I want to cache, to be cached.

Is there some kind of preference somewhere that specifies pages that should never be cached?? Because it's very odd that the web/guest/default page doesn't ever cache (logged in or logged out, regardless of the portlets on the page), when the rest of the pages do.

Ideally, I'd like to cache per user per page rather than per IP address per page, as well. So that if one user logs in from Japan and then logs in from Australia to access the same page, that page will not be re-rendered on the fly.
Ray Augé
RE: page caching when signed in?
May 16, 2008 11:15 AM
Answer

Ray Augé

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1195

Join Date: February 7, 2005

Recent Posts

Hmm, way back then (emoticon) we were using oscache.

Can you make sure of two things:

1) The Layout Cache filter is configured in ROOT/WEB-INF/web.xml and in ROOT/WEB-INF/lib/portal-ejb.jar!system.properties
2) Oscache is configured and working properly in ROOT/WEB-INF/lib/portal-ejb.jar!portal.properties

PS: override those two props files in ROOT/WEB-INF/classes/*-ext.properties or wherever jboss wants them (don't recall off the top of my head).

You should be able to oscache (com.opensymphony.oscache) to your log4j logging config to see if you're getting any cache hits at all.
Michael Bosworth
RE: page caching when signed in?
May 16, 2008 1:26 PM
Answer

Michael Bosworth

Rank: New Member

Posts: 24

Join Date: May 22, 2006

Recent Posts

Ray Augé:
Hmm, way back then (emoticon) we were using oscache.

Can you make sure of two things:

1) The Layout Cache filter is configured in ROOT/WEB-INF/web.xml


<filter>
<filter-name>Layout Cache Filter - Friendly</filter-name>
<filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
<init-param>
<param-name>pattern</param-name>
<param-value>0</param-value>
</init-param>
</filter>
<filter>
<filter-name>Layout Cache Filter - Layout</filter-name>
<filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
<init-param>
<param-name>pattern</param-name>
<param-value>1</param-value>
</init-param>
</filter>
<filter>
<filter-name>Layout Cache Filter - Resource</filter-name>
<filter-class>com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter</filter-class>
<init-param>
<param-name>pattern</param-name>
<param-value>2</param-value>
</init-param>
</filter>

and in ROOT/WEB-INF/lib/portal-ejb.jar!system.properties


#
# The layout cache filter will cache pages to speed up page rendering for
# guest users. Set the refresh time in milliseconds on how often the cache
# should refresh. Set it to 0 if the cache never times out. Default time out
# is set to one hour.
#
com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter=true
com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.encoding=UTF-8
com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.refresh.time=3600000


2) Oscache is configured and working properly in ROOT/WEB-INF/lib/portal-ejb.jar!portal.properties

##
## OSCache
##

#
# The following OSCache settings are used in conjunction with Hibernate if
# you set Hibernate to use OSCache as its cache provider. Consult the
# OSCache documentation for an exhaustive list of available settings.
#
cache.memory=true
cache.capacity=10000
cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache
cache.blocking=false

###

hibernate.cache.provider_class=com.liferay.portal.spring.hibernate.OSCacheProvider

#
# Set other Hibernate cache settings.
#
hibernate.cache.use_query_cache=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_minimal_puts=true
hibernate.cache.use_structured_entries=false

PS: override those two props files in ROOT/WEB-INF/classes/*-ext.properties or wherever jboss wants them (don't recall off the top of my head).
override them with what?

You should be able to oscache (com.opensymphony.oscache) to your log4j logging config to see if you're getting any cache hits at all.


Another approach would be to just upgrade the portal to the newest version.

Is the newest version backwards-compatible with the portlets from 4.1?

Thanks,
Mike
Kenneth Chung
RE: page caching when signed in?
August 10, 2009 8:11 AM
Answer

Kenneth Chung

Rank: New Member

Posts: 2

Join Date: May 20, 2008

Recent Posts

I've found that the CacheFilter java won't let login user use it...

That's why cache cannot apply to login user.

Why you guys disable it???