We used cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. What For?

Liferay Performance Tuning

Performance tuning

 

Performance tuning is a very important aspect of 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.

  • com.liferay.portal.servlet.filters.sso.cas.CASFilter=false

The CAS filter is used to provide CAS based single sign on.

  • com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter=false

The NTLM filter is used to provide NTLM based single sign on.

  • com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter=false

The NTLM post filter is used to fix known issues with NTLM and ajax requests.

  • com.liferay.portal.servlet.filters.sso.opensso.OpenSSOFilter=false

The OpenSSO filter is used to provide OpenSSO based single sign on.

  • com.liferay.portal.servlet.filters.gzip.GZipFilter=false

If the user can unzip compressed HTTP content, the GZip filter will zip up the HTTP content before sending it to the user.

  • com.liferay.portal.servlet.filters.strip.StripFilter=false

The strip filter will remove blank lines from the outputted content.

  • com.liferay.portal.sharepoint.SharepointFilter=false

The Sharepoint filter allows users to access documents in the Document Library directly from Microsoft Office using the Sharepoint protocol.

  • com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter=true

Enabling the layout cache filter will cache pages to speed up page rendering for guest users.

  • com.liferay.portal.servlet.filters.validhtml.ValidHtmlFilter=false

This filter moves JavaScript files within the HTML body tag. This filter adds overhead for every request. It is recommended to keep this filter disabled to improve performance.

        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.

 

  • CSS, Javascript, Theme related properties:
  • portlet.css.enabled=false

Setting it to false will disable the ability to modify the portlet CSS at runtime, which can speed up performance.

  • look.and.feel.modifiable=false

Setting this to false the system will not allow users to modify the look and feel.

  • theme.css.fast.load=true

Set this property to true to load the theme's merged CSS files for faster loading for production server.

  • theme.images.fast.load=true

Set this property to true to load the theme's merged image files for faster loading for production server.

  • javascript.fast.load=true

Set this property to true to load the combined JavaScript files from the property javascript.files into one compacted file for faster loading for production.

  • velocity.engine.resource.manager.cache.enabled=true

Set this property to true in production server so that VM templates are cached.

  • layout.template.cache.enabled=true

Set this property to true to cache the content of layout templates. This will improve performance for production server.

  • last.modified.check=false

Set this property to false to disable checking the lastmodified date on server side CSS and JavaScript.

  • combo.check.timestamp=false

This property should be set to false during production for faster performance. The combo servlet combines multiple JavaScript files into a bundle based on shared dependencies. This makes loading JavaScript files much faster.

 

  • Some other properties:
  • direct.servlet.context.reload=false

The system always checks for the last modified date of the JSP pages. It is recommended to disable this check in the production environment.

 

  • session.tracker.memory.enabled=false

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.

 

  • counter.increment=2000

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.

 

  • permissions.inline.sql.check.enabled=false

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.

 

  • blogs.ping.google.enabled=false

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 protected].

contact-us Request a callback WhatsApp