<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Adding comments issue</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121184610" />
  <subtitle>Adding comments issue</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121184610</id>
  <updated>2026-04-04T15:16:59Z</updated>
  <dc:date>2026-04-04T15:16:59Z</dc:date>
  <entry>
    <title>RE: Adding comments issue</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121386207" />
    <author>
      <name>K K</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121386207</id>
    <updated>2022-03-29T16:52:53Z</updated>
    <published>2022-03-28T13:54:27Z</published>
    <summary type="html">&lt;p&gt;There's an LPS about this and it seems they just fixed it. https://issues.liferay.com/browse/LPS-148618&lt;/p&gt;</summary>
    <dc:creator>K K</dc:creator>
    <dc:date>2022-03-28T13:54:27Z</dc:date>
  </entry>
  <entry>
    <title>RE: Adding comments issue</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121221477" />
    <author>
      <name>Rafał Pydyniak</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121221477</id>
    <updated>2021-10-29T12:13:32Z</updated>
    <published>2021-10-28T09:24:53Z</published>
    <summary type="html">&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;anyone can help? I did a test on newest version (&lt;a
  href="https://hub.docker.com/layers/liferay/portal/7.4.3.4-ga4/images/sha256-5da7cd4172f6247176fc0dba5d1c2917a7e5b96cf18614783f215fab5fb45f8b?context=explore"&gt;7.4.3.4-ga4&lt;/a&gt;)
  and the issue is still here. Steps to reproduce:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Start portal from the docker image e.g. docker run -it -p 8080:8080 liferay/portal:7.4.3.4-ga4&lt;/li&gt;
  &lt;li&gt;Log in&lt;/li&gt;
  &lt;li&gt;Add a lot of pages e.g. using the JS script below (change
    parentLayoutId! You can use 0 if you don't want the page to be
    subpage of any other):&lt;br /&gt;  for(let i=0; i&amp;lt;1000; i++) {&lt;br /&gt;
    Liferay.Service(&lt;br /&gt;    '/layout/add-layout',&lt;br /&gt;    {&lt;br /&gt;   
      groupId: 20123,&lt;br /&gt;      privateLayout: false,&lt;br /&gt;     
    parentLayoutId: 14,&lt;br /&gt;      name: 'Layout-test' + i,&lt;br /&gt;     
    title: 'Layout-test' + i,&lt;br /&gt;      description: '',&lt;br /&gt;     
    type: 'portlet',&lt;br /&gt;      hidden: true,&lt;br /&gt;      friendlyURL:
    ''&lt;br /&gt;    },&lt;br /&gt;    function(obj) {&lt;br /&gt;     
    console.log(obj);&lt;br /&gt;    }&lt;br /&gt;  );&lt;br /&gt;  }&lt;/li&gt;
  &lt;li&gt;I suggest adding at least 5000 pages by using the script above few
    times (I tried to do that at once but it failed at some point, I
    think because of resources). You can also verify afterwards that all
    the pages were created by going to Control Panel -&amp;gt; System
    settings -&amp;gt; Server administration -&amp;gt; Script and use
    script:&lt;br /&gt;  number =
    com.liferay.portal.kernel.service.LayoutLocalServiceUtil.getLayoutsCount();&lt;br /&gt;  out.println(number);&lt;/li&gt;
  &lt;li&gt;Go to any page and add &amp;quot;Page comments&amp;quot; widget. Add
    comment and count time. For me it was 2 minutes . In real world
    scenario it would've been much more because there is a loop on all
    layouts and all portlets on these layouts - in this simple example
    the pages are empty.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The 5000 pages is not an imaginary example - I have that in one of my projects&lt;/p&gt;</summary>
    <dc:creator>Rafał Pydyniak</dc:creator>
    <dc:date>2021-10-28T09:24:53Z</dc:date>
  </entry>
  <entry>
    <title>Adding comments issue</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121184609" />
    <author>
      <name>Rafał Pydyniak</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121184609</id>
    <updated>2021-10-05T08:20:39Z</updated>
    <published>2021-10-05T08:20:38Z</published>
    <summary type="html">&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I'm working on a quite large portal. It has been recently migrated
  from Liferay 6.2 to Liferay 7.4.1. The migration itself went fine and
  we managed to make the portal work like it should but we're still
  struggling with one last issue.&lt;/p&gt;
&lt;p&gt;The issue is that we use the &amp;quot;Page comments&amp;quot; portlet on
  some pages and it seems to be broken. I did some debugging through
  Liferay code and some sampling of running Liferay instance and I found
  out that the issue is related to the way Liferay adds comments.&lt;/p&gt;
&lt;p&gt;Basically in MBMessageLocalServiceImpl there is a method called
  &amp;quot;startWorkflowInstance&amp;quot; which calls
  &amp;quot;getMessageURL&amp;quot; and then it goes to
  PortalImpl.getLayoutFullURL-&amp;gt;PortalImpl.getPlidFromPortletId. The
  whole stacktrace on the screen below:&lt;/p&gt;
&lt;p&gt;
  &lt;img alt="" src="/documents/14/0/stacktrace.png/7930cb02-2cca-8d12-943c-77c9708d1958?t=1633421306983&amp;amp;imagePreview=1" /&gt;
  &lt;br /&gt; In this last method call (getPlidFromPortletId(
  List&amp;lt;Layout&amp;gt; layouts, String portletId, long scopeGroupId))
  there is for loop:&lt;/p&gt;
&lt;p&gt;for (Layout layout: layouts) and then another for loop inside for
  (Portlet portlet : layoutTypePortlet.getAllPortlets()). Also for each
  layout there is a method call for &amp;quot;getScopeGroupId&amp;quot; and then
  &amp;quot;_getScopeGroupId&amp;quot; which is quite long itself as it calls
  for portlet preferences setup&lt;/p&gt;
&lt;p&gt;This makes it really long for one of our sites which has more than
  5000 layouts and adding message longs &lt;strong&gt;really really long
  time&lt;/strong&gt; - about 5 minutes.&lt;/p&gt;
&lt;p&gt;I tried to increase the ehcache settings:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;timeToIdleSeconds - to make the cached result stay in cache for
    longer time&lt;/li&gt;
  &lt;li&gt;maxElementsInMemory - some of the caches were full so I tried to
    increase that&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;It worked &amp;quot;a little bit&amp;quot; but it still takes about four
  minutes. I found out that even though I increased some of the
  FinderCache it didn't work. Below is example finder cache I tried to increase:&lt;/p&gt;
&lt;pre&gt;
&amp;lt;cache
        eternal=&amp;quot;false&amp;quot;
        maxElementsInMemory=&amp;quot;100000&amp;quot;
        name=&amp;quot;com.liferay.portal.kernel.dao.orm.FinderCache.com.liferay.portal.model.impl.PortletPreferencesImpl&amp;quot;
        overflowToDisk=&amp;quot;false&amp;quot;
        timeToIdleSeconds=&amp;quot;86400&amp;quot;
&amp;gt;
&amp;lt;/cache&amp;gt;&lt;/pre&gt;
&lt;p&gt;Please note that I increase the EntityCache in the same
  module-multi-vm.xml and it works for EntityCache but for FinderCache -
  I found out that it's not created &amp;quot;right away&amp;quot; but only
  after the finder is first called so I guess there is some specific
  code that sets the settings directly and I couldn't find a way to
  override that cache settings.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;To sum up. My questions are:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Do anyone have any idea how that issue can be fixed? Anyone knows
    if there are any plans for fixing that in next Liferay version for
    example? My clien't doesn't have a DXP subscription sadly so I can't
    contact the support :(&lt;/li&gt;
  &lt;li&gt;What is the idea of this &amp;quot;startWorkflowInstance&amp;quot; method?
    We don't use workflow so perhaps it's reduntant? Perhaps I can
    override that method with Service Wrapper somehow and get rid of
    that part? Won't it break anything? I don't need workflow if it's
    only for that.&lt;/li&gt;
  &lt;li&gt;Is there any way of increasing that finder cache? I couldn't find
    any other way of doing that in the docs&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Rafał Pydyniak</dc:creator>
    <dc:date>2021-10-05T08:20:38Z</dc:date>
  </entry>
</feed>
