Liferay Performance

Introduction #

The aim of this article is to collect performance enhancing tweaks, tips and techniques. Please contribute your own techniques for enhancing performance.

Startup #

 ##Lucene Search
 #Set the following to true if you want to index your entire 
library of files on startup.
 index.on.startup=false

General performance #

System.properties;
 # The layout cache filter will cache pages to speed up page rendering for
 # guest users. See ehcache.xml to modify the cache expiration time to live.
 com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter=true
Disable unneeded filters
##
## Servlet Filters
##

....
    #
    # The audit filter populates the AuditRequestThreadLocal with the
    # appropriate request values to generate audit requests.
    #
    com.liferay.portal.servlet.filters.audit.AuditFilter=false

and many more 

Minimize output #

Compression Filter #

There is a known optimilisation for LR 5.0+ Compression Filter
<filter>
 <filter-name>Cache Filter - Resource CSS JSP</filter-name>
   <filter-class>
     com.liferay.portal.servlet.filters.cache.CacheFilter
   </filter-class>
 <init-param>
  <param-name>url-regex-pattern</param-name>
  <param-value>.+/(barebone|css|everything)\.jsp</param-value>
 </init-param>
 <init-param>
  <param-name>pattern</param-name>
  <param-value>2</param-value>
 </init-param>
</filter>

HTML #

Saves some 50Kb on every page but portlet look-feel modification is not possible for all (including (Omni)Admin)
 ## Portlet CSS Portlet
 # Set this to true to enable the ability to modify portlet CSS at runtime
 # via the Look and Feel icon. Disabling it can speed up performance.
 portlet.css.enabled=false
#
# Set this to false if the system does not use allow users to modify the
# look and feel.
#
look.and.feel.modifiable=true

Javascript #

Not needed scripts could be expunged here. But the fattest of them all jQuery is needed almost always
 ## JavaScript
 # Set a list of JavaScript files that will be loaded programmatically in
 # /html/common/themes/top_js.jsp.
 #
 # The ordering of the JavaScript files is important. Specifically, all
 # JQuery scripts should go first.
 #
 # The Liferay scripts are grouped in such a way, that the first grouping
 # denotes utility scripts that are used by the second and third groups. The
 # second grouping denotes utility classes that rely on the first group, but
 # does not rely on the second or third group. The third grouping denotes
 # modules that rely on the first and second group.
 #
 javascript.files= .....
Setting this will improve download time, but tweaks above are probably unused
 ## JavaScript
 # 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. Set this property to false for easier debugging for
 # development. You can also disable fast loading by setting the URL
 # parameter "js_fast_load" to "0".
 javascript.fast.load=true

CSS #

 ## Theme
 # Set this property to true to load the theme's merged CSS files for faster
 # loading for production. Set this property to false for easier debugging
 # for development. You can also disable fast loading by setting the URL
 # parameter "css_fast_load" to "0".
 theme.css.fast.load=true

Resources #

Get your images and other resources from your personalised theme or even an HTTP server alias like www.liferay.org/resources/ Resources uploaded in Liferay are being served-up from database and will always be slower than using this strategy. especialy for recurring enterprise logo's and all.

Themes #

If you need a high performing landing-page and other pages you could consider creating a special theme for these pages.

Velocity Caching #

    # Set this to true in production so that VM templates are cached
    velocity.engine.resource.manager.cache.enabled=true

CSS #

Hack removing ALL CSS
edit templates\portal_normal.vm;
 <head>
 #if ( $is_signed_in ) 
  #css ($css_main_file)  
 #end
 </head>

Javascript #

Hack removing ALL scripts en catching script exceptions LR 4.3.4
edit templates\portal_normal.vm;
 <head>
  <title>$company_name - $the_title</title>
 #if ( $is_signed_in && ($permissionChecker.isOmniadmin() )  )
   $theme.include($top_head_include)
 #else
  <script type="text/javascript">
    // hack catching exceptions
    Liferay = function() {return {};}();
    Liferay.Portlet = {
     isAjax: function(id) {return true;},
     process: function(id) {}
    };
    Liferay.Session = {init: function(params) {}};
  </script>
 #end
 #css ($css_main_file)  
 #if ( $is_signed_in && ($permissionChecker.isOmniadmin() )  )
   #js ($js_main_file)
  #end
 </head>
only use $is_signed_in for all signed in users/admin's
 $is_signed_in

Database #

MySQL:
Links to useful references:
General SQL: clustering databases
Sequoia
Sequoia is a transparent middleware solution offering clustering, load balancing and failover services for any database. Sequoia is the continuation of the C-JDBC project. The database is distributed and replicated among several nodes and Sequoia balances the queries among these nodes. Sequoia handles node and network failures with transparent failover. It also provides support for hot recovery, online maintenance operations and online upgrades.
http://sequoia.continuent.org/HomePage

Browser #

Firefox
If you're serving content using SSL, open the URL
   about:config
Locate the value:
   browser.cache.disk_cache_ssl
Double-click to set value to true
Without this setting, each and every page load will reload all the images and CSS, making pages load about 5 times slower.

Application Server #

WebSphere:
   Enable Servlet Caching & Dynamic Caching.
Dynamic Caching:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tdyn_enablecache.html
Servlet Caching:
http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1index.jsp?topic=/com.ibm.websphere.zseries.doc/info/zseries/ae/tdyn_servletcaching.html
Optional: Create a cachespec.xml to cache dynamic content:
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tdyn_dynamiccacheconfig.html (Without a cachespec.xml only static content is cached, but are there any dynamic jsps with a constant static output?)
But be careful, these settings need a powerful Application Server.
Improvement: Approxamately 50% faster
Probably this works also with other Application Servers like Tomcat...

Children Pages

3 comments: