Book Image

Liferay Portal Performance Best Practices

By : Samir Bhatt
Book Image

Liferay Portal Performance Best Practices

By: Samir Bhatt

Overview of this book

Liferay portal is the leading horizontal portal product available in the market. It was named lLeader in Gartner's Magic Quadrant for Horizontal Portals. Because of the flexibility offered by Liferay Portal for customizations, it is becoming a preferred best choice for portal implementations. Many influential sites have been implemented with or have switched to the Liferay portal. More and more Liferay developers and architects are needed in the IT industry.Liferay Portal Performance Best Practices will guide you in how to build high performing Liferay -based solutions. The book guides you on how to define the architecture of Liferay- based solutions to meet performance expectations. You will learn how to fine- tune the Liferay portal using configuration changes or applying the right caching strategy. By the time you finish reading, you will realize that you know all the essential best practices to improve the performance of the Liferay portal solution. The book comprises of Liferay portal performance best practices related to various aspects. It starts with the architecture and design best practices and ends with performance tuning and lLoad testing best practices. The book follows the logical flow. In the first chapter it talks about various architectural options and best practices. It also talks about the consequences of various architectural options. It talks about how to configure the Liferay portal to work in a clustered environment. It discusses the various options available in a cluster configuration. The book further talks about various configuration options of different components that are available for improving performance. The book also talks about various development best practices. It concludes with best practices related to load testing and a performance tuning exercise. Liferay Portal Performance Best Practices explains performance best practices with real examples and samples. By the end of this book, the reader will have learned everything he/she needs to know about Liferay portal performance best practices.
Table of Contents (13 chapters)

The Documents and Media Library architecture


Documents and Media Library is one of the most important functionality of Liferay Portal. It allows users to manage documents, images, videos, and other types of documents. This functionality is designed in such a way that metadata is stored in the database, while actual files are stored on pluggable repository stores. Liferay Portal ships with various built-in repository stores. In this section, we will learn about these repository stores and the best practices associated with them.

File System and Advanced File System stores

Both File System store and Advance File System store are similar with some exceptions. Both of these store files on the filesystem. Advanced File System stores additionally distributes files in a multiple folder structure to eliminate limitations of the filesystem. The File System store is the default repository store used by Liferay Portal. Compared to other repository stores, both of these stores give better performance.

Liferay doesn't handle file locking when we use any of these two stores. Hence on production environments, they must be used with Storage Area Network (SAN) with file locking capabilities. Most of the SAN providers support file locking, but this has to be verified before using them.

To get best performance results, it is recommended to use an Advanced File System store with SAN. In our reference architecture, we have used the same approach for the Media Library repository. Liferay can be configured to use the Advanced File System store by using the following properties in portal-ext.properties:

dl.store.impl=com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore
dl.store.file.system.root=<Location of the SAN directory>

The Database store

This repository store simply stores files in the Liferay database. Concurrent access to files is automatically managed as files are stored in the database. From the performance point of view, this store will give bad results when compared to File System and Advanced File System stores. Also, if the Portal is expected to have heavy use of the Media Library functionality, then this repository store will also affect the overall performance of the Portal, as the load on the database will increase for file management. It is not recommended to use this store unless the use of the Media Library is limited. Liferay Portal can be configured to use the Database store by adding the following property in portal-ext.properties:

dl.store.impl=com.liferay.portlet.documentlibrary.store.DBStore

The JCR store

Java Content Repository (JCR) is the result of the standardization of content repositories used across content management systems. It follows the JSR-170 standard specification. Liferay Portal also provides the JCR store, which can be configured with the Media Library. The JCR store internally uses Apache Jackrabbit, which is an implementation of JSR-170. Apache Jackrabbit also, by default, stores files in a filesystem. It can be also configured to use the database for storing medial library files. For the production environment if we plan to use JCR, it must be configured to store files in the database. As on a filesystem, we can get file locking issues. The JCR store is a good option for the production environment when it is not possible to use the Advanced File System store with SAN. To configure Liferay to use the JCR store, we need to add the following properties to portal-ext.properties:

dl.store.impl=com.liferay.portlet.documentlibrary.store.JCRStore

The CMIS store

Content Management Interoperability Services (CMIS) is an open standard that defines services for controlling document management repositories. It was created to standardize content management services across multiple platforms. It is the latest standard used by most of the content management systems to make content management systems interoperable. It uses web services and RESTful services that any application can access. Liferay provides the CMIS store which can connect to any CMIS-compatible content repositories. The metadata of the Media Library content will be stored in Liferay, and the actual files will be stored in the external CMIS-compatible repository. This repository store can be used when we need to integrate Liferay Portal with external repositories. For example, Alfresco is one of the leading open source content management systems. If we have a requirement to integrate the Alfresco content repository with Liferay, we can use the CMIS store which will internally connect with Alfresco using CMIS services. To configure Liferay with the CMIS repository, we need to add the following properties to portal-ext.properties:

dl.store.impl=com.liferay.portlet.documentlibrary.store.CMISStore
dl.store.cmis.credentials.username=<User Name to be used for CMIS authentication>
dl.store.cmis.credentials.password=<Password to be used for CMIS authentication>
dl.store.cmis.repository.url=<URL of CMIS Repository>
dl.store.cmis.system.root.dir=Liferay Home

The S3 store

Nowadays, companies are moving their infrastructures to the cloud. It provides great benefit in procuring and managing hardware infrastructure. It also allows us to increase or decrease the infrastructure capacity quickly. One of the most popular cloud providers is Amazon AWS. Amazon offers a cloud-based storage service called Amazon Simple Storage Service (Amazon S3). The Liferay Media Library can be configured to store Media Library files on Amazon S3. This is a good option when the production environment is deployed on the Amazon Cloud infrastructure. To configure Liferay to use Amazon S3 for the Media Library store, we need to add the following properties to portal-ext.properties:

dl.store.impl=com.liferay.portlet.documentlibrary.store.S3Store
dl.store.s3.access.key=<amazon s3 access key id>
dl.store.s3.secret.key=<amazon s3 encrypted secret access key>
dl.store.s3.bucket.name=<amazon s3's root folder name>