Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-66988

Create a way to allow ServiceTracker to push out updates, rather than forcing the usages repeatedly polling from it



      This ticket is solving 2 related performance issues:

      1) ServiceTracker internally caches the top ranking service, so pulling the top ranking service repeatedly is actually not a performance concern. However ServiceTracker does not cache missing case, which is when no service available at all. In case of that, it always enters a synchronized block just to see it is empty.

      An use case in our system will be com.liferay.portlet.FriendlyURLMapperTrackerImpl. A lot of portlets don't have FriendlyURLMapper, under concurrent load, threads are blocking each other on the empty FriendlyURLMapper SericeTracker getting.

      2) We use the ProxyFactory.newServiceTrackedInstance() to provide a hook point for modules to inject back things that are used by portal. However it was done via proxy. As a result, even after the modules inject back the instances, portal still calls them via proxy, causing unnecessary overhead.

      Both issues can be solved by this new solution, which is allowing ServiceTracker to inject back the top ranking service when it is available or changed. This way the actually usages are holding to the real references to instances from module, rather than proxies or pulling from ServiceTracker.

      This is a typical "optimizing for read" solution, which is making the usages faster (direct reference, no more proxy or ServiceTracker pulling) by paying the price to make the module instance injecting slower (one more injection to handle via reflection), but considering "read" is way more frequent comparing to "write" (ServiceTracker tracked result changing), it is an improvement to overall system.


          Issue Links



              brian.lee Brian Lee
              shuyang.zhou Shuyang Zhou
              Recent user:
              Kiyoshi Lee
              Participants of an Issue:
              0 Vote for this issue
              0 Start watching this issue




                  Version Package
                  7.0.0 DXP FP1
                  7.0.2 CE GA3
                  7.0.0 DXP SP1
                  7.0.3 CE GA4