Performance tuning is a very important aspect any portal to make it respond quickly and provide smooth user experience.
Here, I am listing some of the optimization areas and Liferay performance tuning tips as well as web application and database layer. You may need to fine tune Liferay portal performance, especially if your site traffic shoots up than you expected. Though having tons of rich UI/features, user wouldn’t like a portal with slow response time.
1. Memory Tuning:
Memory is one of the first things to look at when you want to optimize Liferay portal perfromance. Better performance in production servers is possible with proper configuration of JVM parameters, particularly those related to memory usage and garbage collection. Set your Xms and Xmx to a same value.
Update setenv.sh file which is located at $CATALINA_HOME/bin/setenv.sh as follows (With the assumption that more than 4GB memory is available):
JAVA_OPTS="$JAVA_OPTS -XX:NewSize=700m -XX:MaxNewSize=700m -Xms2048m -Xmx2048m -XX:MaxPermSize=512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=20 -XX:ParallelGCThreads=8"
Depending on available Memory (more than 8 GB), you could increase JVM parameters settings like, -Xms4096m –Xmx4096m -XX:MaxPermSize=1024m
2. Adjust the server's thread pool and JDBC connection pool in tomcat:
Apache should be configured to connector on AJP port i.e. 8009. In a finely tuned system, the number of thread pool should be relatively balanced with the total number of concurrent requests. Liferay recommends setting this initially 50 thread and then monitoring it within your application server’s monitoring consoles.
- $CATALINA_HOME/conf/server.xml :
- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" maxThreads="450" connectionTimeout="20000" keepAliveTimeout="10000" URIEncoding="UTF-8" />
- By default, Liferay is configured for a maximum of 100 database connections. For Tomcat, a good number is between 200 and 400 threads in the thread pool.
3. Properties File (portal-ext.properties) Changes:
- Disable some unnecessary servlet filters(which are not being used):
Liferay uses a number of servlet filters, all of those filters are not necessary for every environment. We can disable some filters like, the GZip filter, the SSO filter, the Sharepoint filter, etc.
The CAS filter is used to provide CAS based single sign on.
The NTLM filter is used to provide NTLM based single sign on.
The NTLM post filter is used to fix known issues with NTLM and ajax requests.
The OpenSSO filter is used to provide OpenSSO based single sign on.
If the user can unzip compressed HTTP content, the GZip filter will zip up the HTTP content before sending it to the user.
The strip filter will remove blank lines from the outputted content.
The Sharepoint filter allows users to access documents in the Document Library directly from Microsoft Office using the Sharepoint protocol.
Enabling the layout cache filter will cache pages to speed up page rendering for guest users.
You can find other filters in portal.properties from portal source code and make it disable which are not in use as per your environment setup.
Setting it to false will disable the ability to modify the portlet CSS at runtime, which can speed up performance.
Setting this to false the system will not allow users to modify the look and feel.
Set this property to true to load the theme's merged CSS files for faster loading for production server.
Set this property to true to load the theme's merged image files for faster loading for production server.
Set this property to true in production server so that VM templates are cached.
Set this property to true to cache the content of layout templates. This will improve performance for production server.
The system always checks for the last modified date of the JSP pages. It is recommended to disable this check in the production environment.
Liferay provides a feature for administrator to view user session activities. But to capture user session activities, it uses a high amount of server resources. It is recommended to disable this feature in the production environment.
Set the number of increments between database updates to the Counter table. Set this value to a higher number for better performance.
- dl.file.rank.enabled=false and dl.file.entry.read.count.enabled=false
The data will be updated in the database whenever documents are downloaded or viewed. If these features are not used in the portal, it is recommended to disable them. It will reduce the load on the Database and Application Servers.
If the Portal is not using social collaboration features, we should switch off the inline permission check to improve the performance of the system. The permission check affects the performance of the system because of heavy database queries.
- blogs.pingback.enabled=false, blogs.trackback.enabled=false and message.boards.pingback.enabled=false
Liferay provides a way to configure the trackback and pingback URLs for each blog and message board posts. Liferay Portal sends requests to the pingback and trackback URLs. This operation uses a good amount of server resources. If pingback and trackback features are not needed, it is recommended to disable it. Because the system will unnecessarily use system resources for these features.
Google provides a search service for blogs. We can search any blog using Google's blog search service. If the portal solution does not require Google blog search integration, it is recommended to disable this option for better performance.
Generally, there are many things you can do to increase Liferay’s performance. You should also load test your system before using it as production server. That is one of the best ways of finding out possible performance related problems.
For more implementation details or support you may contact us at email@example.com.
For professional paid support, you may contact us at firstname.lastname@example.org .