Databases Reference
In-Depth Information
It is difficult to calculate cache control parameters for all cache buckets in the
beginning. Hence, it is recommended to tune them during the load-testing phase.
During the load-testing phase, we should monitor cache statistics and then the
cache control parameters should be tuned based on the cache statistics result.
Caching using Terracotta
In
Chapter 1
,
Architectural Best Practices
, we talked about various caching options
for our Liferay-based solution. We discussed using Terracotta as a centralized cache
server. If the portal is designed to handle huge amounts of traffic and transactions,
it will need a good amount of cache to provide the best performance. In such
situations, it is recommended to go with a high-end, centralized cache server.
Terracotta is one of the most popular products in this space. We can configure
Liferay Portal to cache resources in Terracotta instead of in embedded Ehcache.
Let's learn how to configure Liferay Portal to cache resources in a Terracotta
server. We will configure Terracotta-based caching for our clustered setup
using the following steps:
1.
Download and install Terracotta in a directory on a separate server. This
directory is referred to as
TERRACOTTA_HOME
.
The Terracotta community edition can be downloaded from
http://terracotta.org/downloads/open-source/
catalog
. We need to download
terracotta-x.x.x-
installer.jar
. Here,
x.x.x
is the version of the Terracotta
community edition. We need to follow the installation steps
mentioned at the site to install the Terracotta server.
2.
Now stop the two Liferay Portal servers if they are running.
3.
Locate the
node-01\liferay-portal-6.1.1-ce-ga2\ tomcat-7.0.27\
webapps\ROOT\WEB-INF\lib
directory on
liferay-node-01
and remove
the following files:
ehcache*.jar
slf4j*.jar
4.
Locate the
TERRACOTTA_HOME\ehcache\lib\
directory on the Terracotta
server and copy the following JAR files to the
node-01\liferay-portal-
6.1.1-ce-ga2\ tomcat-7.0.27\webapps\ROOT\WEB-INF\lib
directory
on
liferay-node-01
:
ehcache*.jar
slf4j*.jar