8
votes

I'm new to Liferay developing and I’m facing troubles with the startup of my Liferay Tomcat server. It takes almost 3 minutes (169048 ms) which is unacceptable for development. I’d like to get it down to about one minute.

Here are the specs of my machine:

  • Intel Core Duo T2300 @ 1.66GHz
  • 4GB RAM (3.24GB in use)
  • Windows 7 Enterprise 32 bit with Service Pack 1

I’m using:

  • Liferay 6.1.1-ce-ga2 bundled with Tomcat 7
  • Eclipse IDE Juno Release

In order to speed things up, I’ve:

  • removed all unnecessary portlets from the tomcat\webapps folder.
  • put the Tomcat native library 1.1.24 in the tomcat\bin folder
  • tweaked my portal-ext.properties as shown below
     #disable some filters  
     com.liferay.portal.servlet.filters.sso.cas.CASFilter       = 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.sharepoint.SharepointFilter             = false
     com.liferay.portal.servlet.filters.gzip.GZipFilter         = false

     #disable indexing  
     index.on.startup=false

Here’s my startup log:


    Jan 30, 2013 8:39:49 AM org.apache.catalina.core.AprLifecycleListener init
    INFO: Loaded APR based Apache Tomcat Native library 1.1.24.
    Jan 30, 2013 8:39:49 AM org.apache.catalina.core.AprLifecycleListener init
    INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
    Jan 30, 2013 8:39:51 AM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-apr-8080"]
    Jan 30, 2013 8:39:51 AM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
    Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 2620 ms
    Jan 30, 2013 8:39:51 AM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Jan 30, 2013 8:39:51 AM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
    Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.HostConfig deployDescriptor
    INFO: Deploying configuration descriptor C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\conf\Catalina\localhost\Hi-portlet.xml
    Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.HostConfig deployDescriptor
    WARNING: A docBase C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\Hi-portlet inside the host appBase has been specified, and will be ignored
    Jan 30, 2013 8:39:51 AM org.apache.catalina.startup.SetContextPropertiesRule begin
    WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Hi-portlet' did not find a matching property.
    Jan 30, 2013 8:39:52 AM org.apache.catalina.startup.HostConfig deployDescriptor
    INFO: Deploying configuration descriptor C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\conf\Catalina\localhost\ROOT.xml
    Loading jar:file:/C:/Liferay/portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
    Loading jar:file:/C:/Liferay/portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
    Loading file:/C:/Liferay/portal-6.1.1-ce-ga2/portal-ide.properties
    Loading file:/C:/Liferay/portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes/portal-developer.properties
    Loading file:/C:/Liferay/portal-6.1.1-ce-ga2/portal-ext.properties
    Jan 30, 2013 8:39:59 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    08:40:16,321 INFO  [pool-2-thread-1][DialectDetector:71] Determine dialect for HSQL Database Engine 2
    08:40:16,330 WARN  [pool-2-thread-1][DialectDetector:86] Liferay is configured to use Hypersonic as its database. Do NOT use Hypersonic in production. Hypersonic is an embedded database useful for development and demo'ing purposes. The database settings can be changed in portal-ext.properties.
    08:40:16,484 INFO  [pool-2-thread-1][DialectDetector:136] Found dialect org.hibernate.dialect.HSQLDialect
    Starting Liferay Portal Community Edition 6.1.1 CE GA2 (Paton / Build 6101 / July 31, 2012)
    08:41:36,974 INFO  [pool-2-thread-1][BaseDB:452] Database supports case sensitive queries
    08:41:37,828 INFO  [pool-2-thread-1][ServerDetector:154] Server supports hot deploy
    08:41:37,850 INFO  [pool-2-thread-1][PluginPackageUtil:1030] Reading plugin package for the root context
    08:42:19,657 INFO  [pool-2-thread-1][AutoDeployDir:106] Auto deploy scanner started for C:\Liferay\portal-6.1.1-ce-ga2\deploy
    08:42:24,410 INFO  [pool-2-thread-1][HotDeployImpl:178] Deploying Hi-portlet from queue
    08:42:24,415 INFO  [pool-2-thread-1][PluginPackageUtil:1033] Reading plugin package for Hi-portlet
    Jan 30, 2013 8:42:24 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    Jan 30, 2013 8:42:30 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring FrameworkServlet 'Remoting Servlet'
    Jan 30, 2013 8:42:34 AM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\resources-importer-web
    08:42:35,522 INFO  [pool-2-thread-1][HotDeployImpl:178] Deploying resources-importer-web from queue
    08:42:35,523 INFO  [pool-2-thread-1][PluginPackageUtil:1033] Reading plugin package for resources-importer-web
    Jan 30, 2013 8:42:36 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    Jan 30, 2013 8:42:36 AM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\Liferay\portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\welcome-theme
    08:42:36,609 INFO  [pool-2-thread-1][HotDeployEvent:109] Plugin welcome-theme requires resources-importer-web
    08:42:37,305 INFO  [pool-2-thread-1][HotDeployImpl:178] Deploying welcome-theme from queue
    08:42:37,306 INFO  [pool-2-thread-1][PluginPackageUtil:1033] Reading plugin package for welcome-theme
    Jan 30, 2013 8:42:37 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    08:42:37,787 INFO  [pool-2-thread-1][ThemeHotDeployListener:87] Registering themes for welcome-theme
    08:42:39,764 INFO  [pool-2-thread-1][ThemeHotDeployListener:100] 1 theme for welcome-theme is available for use
    Jan 30, 2013 8:42:40 AM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-apr-8080"]
    08:42:40,167 INFO  [liferay/hot_deploy-1][HotDeployMessageListener:142] Group or layout set prototype already exists for company liferay.com
    Jan 30, 2013 8:42:40 AM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["ajp-apr-8009"]
    Jan 30, 2013 8:42:40 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 169048 ms

Any suggestions?

3
in theory i think you should not have to restart your Liferay server that much, due to redeployment of portlets etc. What are you developing that has such a high need for reboots?Matthias G
Actually, I'm not rebooting the server very often thanks to the hot deploy feature. It's just so annoying when you start it up every morning.FeinesFabi
4GB is a bit limited to run a local liferay & your ide + os + other applications on the same machine..., you could remove the portlets that you don't use but still ...David
There is nothing more to remove except the welcome-theme. I think I'll better leave this untouched. But your're right about the RAM. Maybe my system is simply too slow for this setup.FeinesFabi
I would think it is normal for Portal to take anywhere around 2 to 3 mins to start-up. Since it initializes and registers so many things. I would just say, Welcome to the world of Portals! :-DRasabihari Kumar

3 Answers

2
votes

The comments already gave some hints. I'd say, the most important issue is to check if virtual memory (paging) is used - as soon as the OS has to page memory to disk, you have lost: There's a potentially huge performance hit.

When you upgrade your memory (e.g. if you hit the virtual memory) you might want to consider upgrading the OS to a 64bit OS - 32bit can only address 4G and you might hit limits with appserver memory as each process can only get a limited amount of memory.

You could also test if Liferay starts up faster before you run so many other applications - this is another hint that you're running into a memory issue.

The SSD option will further accelerate your system, but for a much higher price than RAM. Also, virtual memory on SSD is not really recommended - it will wear out the drive quicker. And instead of using virtual memory on SSD, rather don't use virtual memory - this will be quicker AND cheaper.

0
votes

This problem is solved by upgrading to Liferay 7.

While Liferay 7 does not start faster, developers really never need to restart it, as everything can be overridden by deploying new OSGi components. That is actually the biggest difference between Liferay 6 and Liferay 7.

I have been developing for Liferay 7 for 3 months, including very deep customization (for instance intercepting all file reads for audit), and have never needed to restart the Liferay server.

0
votes

The server speed depends so much on a well configured JVM (memory, garbage collector type, etc) and Tomcat connector thread pool. depending of available server resources. Liferay provide a recommended configuration:

`-server -XX:NewSize=1024m -XX:MaxNewSize=1024m -Xms4096m
-Xmx4096m -XX:MetaspaceSize=300m -XX:MaxMetaspaceSize=300m
-XX:SurvivorRatio=12 –XX:TargetSurvivorRatio=90 –
XX:MaxTenuringThreshold=15 -XX:+UseLargePages
-XX:LargePageSizeInBytes=256m -XX:+UseParNewGC
-XX:ParallelGCThreads=16 -XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled -XX:+CMSCompactWhenClearAllSoftRefs
-XX:CMSInitiatingOccupancyFraction=85 -XX:+CMSScavengeBeforeRemark
-XX:+UseLargePages -XX:LargePageSizeInBytes=256m
-XX:+UseCompressedOops -XX:+DisableExplicitGC -XX:-UseBiasedLocking
-XX:+BindGCTaskThreadsToCPUs -XX:+UseFastAccessorMethods
-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=96m`

The above JVM settings should formulate a starting point for your performance tuning. Each system’s final parameters will vary due to a variety of factors including number of current users and transaction speed.

In tomcat servers you define this configuration like CATALINA_OPTS environment variable in /[tomcat_server]/bin/setenv.[sh or bat] file.