Foren

page caching when signed in?

Michael Bosworth, geändert vor 15 Jahren.

page caching when signed in?

New Member Beiträge: 24 Beitrittsdatum: 23.05.06 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: page caching when signed in?

New Member Beiträge: 24 Beitrittsdatum: 23.05.06 Neueste Beiträge
*bump*
Michael Bosworth, geändert vor 15 Jahren.

RE: page caching when signed in?

New Member Beiträge: 24 Beitrittsdatum: 23.05.06 Neueste Beiträge
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
thumbnail
James Min, geändert vor 15 Jahren.

RE: page caching when signed in?

Expert Beiträge: 293 Beitrittsdatum: 14.08.06 Neueste Beiträge
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, geändert vor 15 Jahren.

RE: page caching when signed in?

New Member Beiträge: 24 Beitrittsdatum: 23.05.06 Neueste Beiträge
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.
thumbnail
Ray Augé, geändert vor 15 Jahren.

RE: page caching when signed in?

Liferay Legend Beiträge: 1197 Beitrittsdatum: 08.02.05 Neueste Beiträge
Hmm, way back then (emoticon) we were using oscache.

Can you make sure of two things:

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

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

You should be able to oscache ([tt]com.opensymphony.oscache[/tt]) to your log4j logging config to see if you're getting any cache hits at all.
Michael Bosworth, geändert vor 15 Jahren.

RE: page caching when signed in?

New Member Beiträge: 24 Beitrittsdatum: 23.05.06 Neueste Beiträge
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 [tt]ROOT/WEB-INF/web.xml[/tt]


<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 [tt]ROOT/WEB-INF/lib/portal-ejb.jar!system.properties[/tt]


#
# 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 [tt]ROOT/WEB-INF/lib/portal-ejb.jar!portal.properties[/tt]

##
## 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 [tt]ROOT/WEB-INF/classes/*-ext.properties[/tt] or wherever jboss wants them (don't recall off the top of my head).
override them with what?

You should be able to oscache ([tt]com.opensymphony.oscache[/tt]) 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
thumbnail
Kenneth Chung, geändert vor 14 Jahren.

RE: page caching when signed in?

New Member Beiträge: 2 Beitrittsdatum: 20.05.08 Neueste Beiträge
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???