3

Liferay 6.1 takes roughly 60-120 seconds to start on my developer machine. Unfortunately we have to start Liferay very often, so this delay hurts. Actually, most features of Liferay aren't needed by a developer (at least not for us). Is it possible to reduce the amount of time Liferay takes to start? Maybe by removing unused functionality, such as blog, chat and forum?

Please note that I'm not talking about deployment time, which can be reduced a little by following the hints in another StackOverflow thread.

Community
  • 1
  • 1
Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37
  • I've just seen someone asked the same question last year: [Liferay Startup takes too long](http://stackoverflow.com/questions/14600239/liferay-startup-takes-way-too-long). However, I'm still hoping for better answers, such as a list of portlets that can be deactivated - plus a hint how to deactivate them. Mind you - it's hard to believe Liferay's developers themselves put up with such slow startup times. – Stephan Rauh Apr 15 '14 at 20:40

6 Answers6

2

removing unused functionality - that's a good idea, just it will be hard on Liferay 6.1. This is what modularity promises to make possible for Liferay 7, where you should be able to remove the unwanted OSGi bundles. Unfortunately Liferay 7 is not out yet (as of the time of writing this answer beta4 is out) and you're explicitly asking about 6.1.

You could try to deactivate several components - most likely by changing several of the spring configuration files in an ext plugin. However, this has rarely been done, so it might have consequences that nobody has ever seen. Also, it will probably be hard to maintain and upgrade this configuration.

Another way to solve this problem is to ask "Why do you have to restart so often?". In fact, utilizing JRebel for deployments - especially on a developer machine - has shown to be quite effective.

In the answer to Meera Prince's answer you're stating the "generous memory settings" of 1024G - while I agree that this shouldn't limit you in the upstart time, you might want to monitor it, so that you at least don't run into garbage collection during startup time. For a Java application the size of Liferay, 1G memory might be sufficient, but I'd not call it "generous".

Note that 8G RAM on a development machine might be your limitation: As soon as your machine hits virtual memory and starts paging to disk, all bets are off and you'll suffer. And I have no clue what else you're running: Browsers, IDE, Editors, Word Processor, Liferay, random other applications and services. You're hopefully on a 64bit OS.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • I don't think more memory reduces the startup time. I never found out what Liferay spends so much time with. CPU usage was low. Adding more memory didn't speed thing. Starting Liferay from a ram disk even slows it down. Maybe network connections running on a timeout? – Stephan Rauh Jan 22 '16 at 18:57
  • JRebel has saved my sanity. I had to restart Liferay every once in a while because hot code replacement was broken for some reason. JRebel fixed this. BTW, you make Liferay 7 sound promising! – Stephan Rauh Jan 22 '16 at 18:58
1

If you have 8GB of RAM, then put more for Liferay e.g.

CATALINA_OPTS="-Xms4G -Xmx4G -XX:MaxPermSize=512m" 

using of CATALINA_OPTS is better then JAVA_OPTS, because JAVA_OPTS will be allocated by shutdown of tomcat too, and CATALINA_OPTS only by startup.

And you can disable not necessary Filters in portal-ext.properties, e.g.

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

See Liferay: How to configure Liferay Portal

Community
  • 1
  • 1
Mark
  • 17,887
  • 13
  • 66
  • 93
  • 2
    I don't think increasing memory beyond 2 GB help (unless you've got a memory-hungry portlet). Removing the filters improves the speed of the portal (which is a good thing), but it doesn't help to start up faster. – Stephan Rauh Apr 22 '14 at 08:41
1

If you are using Tomcat to run Liferay, the following will greatly reduce the time it takes to startup. Modifying your catalina.properties file attributes shown below. The article goes into the details.

org.apache.catalina.startup.ContextConfig.jarsToSkip=*
org.apache.catalina.startup.TldConfig.jarsToSkip=*
tomcat.util.scan.DefaultJarScanner.jarsToSkip=*

http://www.gpickin.com/index.cfm/blog/how-to-get-your-tomcat-to-pounce-on-startup-not-crawl

  • Sounds promising. How long does Liferay take to start on your machine? With and without this setting? Did you encounter negative effects, like CDI beans not being detected? BTW, you might want to update your blog post. My Tomcat already skips many libraries by default, and it starts in less than three seconds. – Stephan Rauh Apr 09 '16 at 12:40
  • We are running Liferay 6.2 on a VM. 16G ram, 4 cores. It takes 4 minutes to start. 20 minutes without the mentioned configuration. I specify each file individually that I want to skip. There are a couple of hundred. I used the asterisk above for brevity. There are some files you do not want to skip. Not my blog post:) Wow! I can only dream of a 3 second start. It takes longer than that for us to establish a database connection. – ElectronicBlacksmith Jan 13 '17 at 18:03
  • Seriously? Well, I just hope you've invested in JRebel or [Hotwap Agent](https://dzone.com/articles/hotswap-agent-java-runtime-class-and-resource-rede). If not, I envy your patience! BTW, most modern JavaEE application servers start in less than 10 seconds. – Stephan Rauh Jan 13 '17 at 22:24
  • We restart Liferay infrequently. Most development happens in portlet development and we hot deploy those to an already running instance. – ElectronicBlacksmith Feb 03 '17 at 17:06
  • I'm told this approach works well if you're programming portlets with JSPs and Spring. When I raised the question, we used JSF. For some reason, hot code replacement was almost completely broken. I hope things have improved since then :). – Stephan Rauh Feb 04 '17 at 18:40
1
  • You may buy an SSD HD
  • 8G RAM must be enough for Liferay 6.1 + Browser + Eclipse, however I have 16G, but I very often have two Liferays running an 20+ open browser windows
  • A CPU with 4 core can be relevant
  • Undeploy deployed but not needed portlets
Peter B
  • 257
  • 2
  • 3
  • How long does Liferay take to start on such a configuration? – Stephan Rauh Apr 09 '16 at 12:41
  • without SSD (Acer Aspire E5-572G 16G RAM Linux) Liferay 62CEGA6 + mysql: 32 secs, I will write another configs soon – Peter B Apr 10 '16 at 14:53
  • That's already a lot faster than the Liferay installation I used. Maybe they've improved LR 6.2? – Stephan Rauh Apr 10 '16 at 19:28
  • I tried on Windows 7 (SSD HD, 16G Ram, Dell Latitude, 4 core) 62CEGA6 + mysql : 42 secs. Interesting, I thought, that this machine would faster. Probably Linux file system is faster? I left only the marketplace portlet. I really think, that if somebody has many deployed application, that is definitely slowing the startup. – Peter B Apr 11 '16 at 08:26
  • On the same Dell laptop with Linux, startime is the same. Maybe jdk also can cause differences, on the Acer machine there is JDK8, but on the Dell laptops there are jdk7. – Peter B Apr 11 '16 at 08:48
0

Its depends on resource allocation for liferay JVM means heap and permzen space. and also depends on your system RAM size find java script and css related proprieties in liferay portal.proeprties file.

Use Java_OPTS as follows

-Xms1024m -Xmx1024m -XX:MaxPermSize=512m

https://www.liferay.com/community/wiki/-/wiki/Main/Liferay+Developer+Modee

http://www.liferaysavvy.com/2013/12/liferay-environment-challenges-and.html

https://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/lp-6-1-theme-developer-mode

Meera Prince
  • 177
  • 3
  • I'm already using generous memory settings (-Xmx1024m -XX:MaxPermSize=512m). The PC has 8 GB of RAM. Which is the startup time of an optimally configured Liferay developer server? – Stephan Rauh Apr 10 '14 at 15:15
0

I think, using ramdisk may worth a try.

Windows 7: http://www.laptopmag.com/articles/faster-than-an-ssd-how-to-turn-extra-memory-into-a-ram-disk

Linux: http://www.jamescoyle.net/how-to/943-create-a-ram-disk-in-linux

If you have many deployed plugins, it can shorten the startup time. Without deployed plugins (only with marketplace) I measured the same starttime than with my hdd.

Peter B
  • 257
  • 2
  • 3