« Voltar para Customization

Slimming Liferay Portal

Introduction #

Liferay comes with a lot of functionality bundled that not everybody might need, this article explains how it can be slimmed to gain memory, CPU cycles, etc.

Gaining Memory #

Remove Unused Portlets #

Edit the liferay-portlet.xml (or liferay-portlet-ext.xml if using the ext environment) and add an entry to every portlet that you want to disable setting the include element to false. For example, to remove the mail portlet you can use:

<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_1_0.dtd">
<liferay-portlet-app>

 <portlet>
   <portlet-name>1</portlet-name>
   <struts-path>mail</struts-path>
   <include>false</include>
 </portlet>

</liferay-portlet-app>

Liferay will completely ignore the portlet, making the load process faster and the memory consumption to decrease.

Removing unused web applications/services #

Liferay comes with several auxiliary web applications that can be removed if not needed. These are:

  • cms-web: can be removed if the legacy CMS system is not being used
  • lazslo-web: can be removed if lazslo is not being used
  • tunnel-web: can be removed if Liferay's services are not being accessed remotely

Slimming the database #

Liferay comes with two sets of db creation scripts:

  • create-minimal-.sql: Creates the tables and minimal necessary data
  • create-.sql: Additionally loads a lot of example data and content. It's the one used to populate the HSQL database included in the bundle.

To slim the database, use the create-minimal-.sql scripts.

Gaining CPU Cycles #

Turn off Unused Filters #

Edit the portal-ext.properties and add an entry for every filter that you want to disable. See the Servlet Filters section of the portal.properties file for possible entries and default values. For example, add the following entries to disable the Auto Login, CAS, Header, I18nFilter, Monitoring, NTLM, OpenSSO, Secure, and Sharepoint filters:

com.liferay.portal.servlet.filters.autologin.AutoLoginFilter=false
com.liferay.portal.servlet.filters.sso.cas.CASFilter=false
com.liferay.portal.servlet.filters.header.HeaderFilter=false
com.liferay.portal.servlet.filters.i18n.I18nFilter=false
com.liferay.portal.servlet.filters.monitoring.MonitoringFilter=false
com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter=false
com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter=false
com.liferay.portal.servlet.filters.sso.opensso.OpenSSOFilter=false
com.liferay.portal.servlet.filters.secure.SecureFilter=false
com.liferay.portal.sharepoint.SharepointFilter=false
com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter=false

Additionally, remove or comment out the entries from web.xml:

<!--
...
<servlet>
<servlet-name>I18n Servlet</servlet-name>
<servlet-class>com.liferay.portal.servlet.I18nServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
...
-->

Configure Search Indexer #

Best option is to externalize search to the Solr search plugin. If using Lucene, then edit the portal-ext.properties file to add the following entry:

lucene.optimize.interval=10

"Whenever Liferay calls Lucene to index some content, it may create any number of files to do so. Depending on the content, these files can be large files or lots of small files. Every now and then, Liferay optimizes the index for reading by combining smaller files into larger files. You can change this behavior based on your use case. The property is lucene.optimize.intervalIf you are doing a lot of publishing and loading of data, make the number very high, like 1000. If you are doing mostly reads, make it low, like the default value of 100. Of course, the best thing is to move search out to a separate environment, such as Solr." (Tip No. 7 & 8, http://www.liferay.com/documents/14/8440796/Top+Twelve+Ways+to+Speed+Up+Your+Liferay+Deployment)

Optimize Counter Increment #

"One of the ways Liferay is able to support so many databases is that it does not use any single database's method of determining sequences for primary keys. Instead, Liferay includes its own counter utility which can be optimized. The default value: counter.increment=100 will cause Liferay to go to the database to update the counter only once for every 100 primary keys it needs to create. Each time the counter increments itself, it keeps track of the current set of available keys in an in-memory, cluster aware object. You could set this to a higher number to reduce the number of database calls for primary keys within Liferay." (Tip No. 6 http://www.liferay.com/documents/14/8440796/Top+Twelve+Ways+to+Speed+Up+Your+Liferay+Deployment)

Use Web Server to Serve Static Content #

"Sometimes a CDN is overkill. You can gain similar benefits by configuring your system so that all static content (images, CSS, JavaScript, etc.) is served by your web server instead of by your application server. It is well known that a highly optimized web server can serve static resources a lot faster than an application server can. You can use your proxy configuration and two Liferay properties to let your faster web server send these to the browser, leaving Liferay and your application server to only have to worry about the dynamic pieces of the request." (Tip No. 4, http://www.liferay.com/documents/14/8440796/Top+Twelve+Ways+to+Speed+Up+Your+Liferay+Deployment)  

0 Anexos
45809 Visualizações
Média (2 Votos)
A média da avaliação é 5.0 estrelas de 5.
Comentários
Respostas do tópico Autor Data
Good to know this, but not sufficient information. Jay Patel 30 de Novembro de 2010 03:30
tunnel-web is also used for accessing files... Jelmer Kuperus 22 de Julho de 2011 08:35
Links provided above are broken. Natasa Bulatovic 16 de Julho de 2012 08:01
Good to know this, but not sufficient information. Mohammad Hejazi 11 de Novembro de 2014 22:37

Good to know this, but not sufficient information.
Postado em 30/11/10 03:30.
tunnel-web is also used for accessing files over webdav not just for accessing remote services
Postado em 22/07/11 08:35.
Links provided above are broken.
Postado em 16/07/12 08:01 em resposta a jelmer kuperus.
Good to know this, but not sufficient information.
Postado em 11/11/14 22:37.