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)

Static content delivery


In any dynamic web application, majority of the web requests are for static resources, such as JavaScript, CSS, images, or videos. The same rule also applies to Liferay-Portal-based solutions. Hence, it is very important from an architectural point of view how we serve these static resources. In a basic Liferay Portal setup, static resources are served from the Liferay Portal application server. In this section, we will learn about other options to serve static resources.

Content Delivery Network

Content Delivery Network (CDN) is a large network of servers deployed across the world to serve static resources. The same static resources are stored on multiple servers across the world. When these static resources are requested, they will be retrieved from a server nearby the location of user. This feature reduces response time drastically. Liferay Portal also supports integration with CDNs. In Liferay Portal, majority of the static resources are a part of themes. Liferay provides a way to rewrite URLs of static resources within themes to a URL of the same resource in CDN. By using this feature, we can also reduce the load on the Liferay Portal application server by reducing the number of requests. To configure Liferay with CDN, we need to perform the following steps:

  1. Upload all the static resources from the theme into CDN. CDN providers provide the UI to do the same. This step requires referring to the CDN provider's documentation.

  2. Add the following properties to the portal-ext.properties file:

    cdn.host.http=<CDN host name to server static resources from http request>
    cdn.host.https=<CDN host name to server static resources from https request>

This solution is highly recommended when the intended users are spread across the globe.

Content delivery through the web server

If we serve static resources directly from the web server, it can reduce the number of requests coming to the Liferay Portal application server. Also, static resources can be served faster from the web server than the application server. All portal requests pass through the web server. Hence, it is easy to filter static resource requests and serve them directly from the web server. To implement this option, we do not need to change any configuration on the Liferay Portal application. We need to copy all static resources from all the Liferay plugins to the web server public directory. We need to make changes in the web server configuration so that all the static resource requests are directly served from the web server public directory. In this approach, we need to ensure that we copy the static resources to the web server every time we deploy a new version. This option can be used along with CDN to serve static resources of portlets.

Tip

It is recommended to create an automated shell script to copy static resources from the Liferay Portal application server to the Apache web server as a part of the deployment process.