Slowly liferay instance

Luk Wlbr, modified 7 Years ago. New Member Posts: 20 Join Date: 9/28/18 Recent Posts
Hello everybody,

my liferay 7.1.0 CE GA1 is totally slow... As soon as I deploy a portlet I'm getting a bunch of overheads.

[2018-10-22T14:54:43,400][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][84] overhead, spent [1.4s] collecting in the last [1.8s]
[2018-10-22T14:54:45,385][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][85] overhead, spent [1.7s] collecting in the last [1.9s]
[2018-10-22T14:54:47,083][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][86] overhead, spent [1.3s] collecting in the last [1.6s]
[2018-10-22T14:54:48,926][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][87] overhead, spent [1.6s] collecting in the last [1.8s]
[2018-10-22T14:54:51,012][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][88] overhead, spent [1.5s] collecting in the last [2s]
[2018-10-22T14:54:53,237][WARN ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][89] overhead, spent [2s] collecting in the last [2.2s]
[2018-10-22T14:54:54,763][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][90] overhead, spent [1.2s] collecting in the last [1.5s]
[2018-10-22T14:54:57,302][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][91] overhead, spent [2.2s] collecting in the last [2.5s]
[2018-10-22T14:54:59,513][INFO ][o.e.m.j.JvmGcMonitorService] [3npzYkq] [gc][92] overhead, spent [1.8s] collecting in the last [2.2s]

Sometimes when i deploy more than one portlet, I'm getting so many overheads, that i can't even stop liferay.
These are standard portlets built just like the Richfaces sample portlet.

I've tested the problem on Windows and Ubuntu with the same behavior.

Does anyone know why it is so slow? 
thumbnail
Kyle Joseph Stiemann, modified 7 Years ago. Liferay Master Posts: 760 Join Date: 1/14/13 Recent Posts
Hi Luk,
Have you tried increasing the Java heap memory size for your server? For example, in Tomcat you can increase the memory by increasing the values of Xmx and/or Xms in $LIFERAY_HOME/tomcat/bin/setenv.sh (or setenv.bat for Windows):

-Xmx3072m -Xms512m

- Kyle
Luk Wlbr, modified 7 Years ago. New Member Posts: 20 Join Date: 9/28/18 Recent Posts
Kyle Joseph StiemannHi Luk,
Have you tried increasing the Java heap memory size for your server? For example, in Tomcat you can increase the memory by increasing the values of Xmx and/or Xms in $LIFERAY_HOME/tomcat/bin/setenv.sh (or setenv.bat for Windows):

-Xmx3072m -Xms512m

- Kyle
Hi Kyle,

Thanks for your reply!
Yes I tried it, but no matter how high I set the heapsize, I get an overhead.
Even if the heapsize isn't even quite reached I get an overhead.

- Luk
thumbnail
Kyle Joseph Stiemann, modified 7 Years ago. Liferay Master Posts: 760 Join Date: 1/14/13 Recent Posts
Hi Luk,
How many portlets/WARs do you have deployed? Have you set the MaxMetaspaceSize? Can you list all your JVM memory settings?

- Kyle
Luk Wlbr, modified 7 Years ago. New Member Posts: 20 Join Date: 9/28/18 Recent Posts
Thank you all for the answers! I appreciate it!

It was the MaxMetaspaceSize which was set to the standard 512mb...
As soon as I deployed only one war-file, it came to overhead.

I've removed the MaxMetaspaceSize and now and it works perfectly! 

For the sake of completeness:
set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -XX:NewRatio=3 -Xms1560m -Xmx3072m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=20 -XX:ParallelGCThreads=8"

Best regards
- Luk
thumbnail
Kyle Joseph Stiemann, modified 7 Years ago. Liferay Master Posts: 760 Join Date: 1/14/13 Recent Posts
Glad it's working for you, Luk! Thanks for posting the solution and for using Liferay and Liferay Faces!

- Kyle
Amos Fong, modified 7 Years ago. New Member Posts: 20 Join Date: 9/28/18 Recent Posts
I tried to deinstall elasticsearch in Liferay, because I saw that every garbage collection came from elasticseach,
but now i cannot even deploy my portlets.

I'm getting an IndexOutOfBounds:
Oct 23 11:12:21 sdacims01t catalina.sh[9046]: 2018-10-23 09:12:21.960 ERROR [http-nio-8080-exec-6][PortletRequestDispatcherImpl:299] Unable to dispatch request: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Oct 23 11:12:35 sdacims01t catalina.sh[9046]: 2018-10-23 09:12:24.926 ERROR [http-nio-8080-exec-6][PortletServlet:112] javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Oct 23 11:12:35 sdacims01t catalina.sh[9046]: javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.portlet.internal.PortletRequestDispatcherImpl.dispatch(PortletRequestDispatcherImpl.java:301)
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.portlet.internal.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:128)
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.include(MVCPortlet.java:594)
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.include(MVCPortlet.java:610)
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.doView(MVCPortlet.java:160)
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:305)
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:497)
Oct 23 11:12:35 sdacims01t catalina.sh[9046]:         at com.liferay.marketplace.app.manager.web.internal.portlet.MarketplaceAppManagerPortlet.doDispatch(MarketplaceAppManagerPortlet.java:413)
.
.
.

Are there any others configurations to optimize performance?

I'm helpless...
​​​​​​​

Thanks in advance.

- Luk
thumbnail
Olaf Kock, modified 7 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Luk WlbrI tried to deinstall elasticsearch in Liferay, because I saw that every garbage collection came from elasticseach,
but now i cannot even deploy my portlets.
You may want to run Elasticsearch in a separate JVM (the only production-supported way to operate it in Liferay DXP). Read about the setup in these (sub-)chapters. This way you can set explicit parameters just for Elasticsearch. Liferay requires some search engine to run, and the embedded Elasticsearch is good for demo and test, but not for productive use.