[ 
https://issues.apache.org/jira/browse/FELIX-6399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17351599#comment-17351599
 ] 

Joerg Hoh commented on FELIX-6399:
----------------------------------

I found that these threads can also consume a lot processing power, I saw this 
thread consume a significant amount of CPU.

{noformat}
"pool-15-thread-1" #87 prio=5 os_prio=0 cpu=205152.73ms elapsed=390.39s 
tid=0x00005607aa26c800 nid=0x1607 runnable  [0x00007f3316d26000]
   java.lang.Thread.State: RUNNABLE
        at 
org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl.convert(ServiceComponentRuntimeImpl.java:410)
        at 
org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl.deepCopy(ServiceComponentRuntimeImpl.java:385)
        at 
org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl.holderToDescription(ServiceComponentRuntimeImpl.java:369)
        at 
org.apache.felix.scr.impl.runtime.ServiceComponentRuntimeImpl.getComponentDescriptionDTOs(ServiceComponentRuntimeImpl.java:92)
        at 
org.apache.felix.rootcause.DSRootCause.getCandidates(DSRootCause.java:84)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:68)
        at 
org.apache.felix.rootcause.DSRootCause.lambda$getCandidates$2(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause$$Lambda$335/0x00000008007a3840.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.rootcause.DSRootCause.getCandidates(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:68)
        at 
org.apache.felix.rootcause.DSRootCause.lambda$getCandidates$2(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause$$Lambda$335/0x00000008007a3840.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.rootcause.DSRootCause.getCandidates(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:68)
        at 
org.apache.felix.rootcause.DSRootCause.lambda$getCandidates$2(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause$$Lambda$335/0x00000008007a3840.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.rootcause.DSRootCause.getCandidates(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:68)
        at 
org.apache.felix.rootcause.DSRootCause.lambda$getCandidates$2(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause$$Lambda$335/0x00000008007a3840.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.rootcause.DSRootCause.getCandidates(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:68)
        at 
org.apache.felix.rootcause.DSRootCause.lambda$getCandidates$2(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause$$Lambda$335/0x00000008007a3840.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.rootcause.DSRootCause.getCandidates(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:68)
        at 
org.apache.felix.rootcause.DSRootCause.lambda$getCandidates$2(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause$$Lambda$335/0x00000008007a3840.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.rootcause.DSRootCause.getCandidates(DSRootCause.java:86)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:68)
        at 
org.apache.felix.rootcause.DSRootCause.getRootCause(DSRootCause.java:51)
        at 
org.apache.felix.systemready.impl.ComponentsCheck$$Lambda$354/0x0000000800813840.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.systemready.impl.ComponentsCheck.getStatus(ComponentsCheck.java:93)
        at 
org.apache.felix.systemready.impl.SystemReadyMonitorImpl.getStatus(SystemReadyMonitorImpl.java:150)
        at 
org.apache.felix.systemready.impl.SystemReadyMonitorImpl$$Lambda$347/0x0000000800811c40.apply(Unknown
 Source)
        at 
java.util.stream.ReferencePipeline$3$1.accept(java.base@11.0.10/Unknown Source)
        at 
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.10/Unknown 
Source)
        at 
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java.base@11.0.10/Unknown
 Source)
        at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.10/Unknown 
Source)
        at java.util.stream.ReferencePipeline.collect(java.base@11.0.10/Unknown 
Source)
        at 
org.apache.felix.systemready.impl.SystemReadyMonitorImpl.evaluateAllChecks(SystemReadyMonitorImpl.java:135)
        at 
org.apache.felix.systemready.impl.SystemReadyMonitorImpl.check(SystemReadyMonitorImpl.java:119)
        at 
org.apache.felix.systemready.impl.SystemReadyMonitorImpl$$Lambda$338/0x00000008007e9040.run(Unknown
 Source)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.10/Unknown 
Source)
        at 
java.util.concurrent.FutureTask.runAndReset(java.base@11.0.10/Unknown Source)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(java.base@11.0.10/Unknown
 Source)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.10/Unknown 
Source)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.10/Unknown 
Source)
        at java.lang.Thread.run(java.base@11.0.10/Unknown Source)
{noformat}

> Reduce resource consumption during component checks
> ---------------------------------------------------
>
>                 Key: FELIX-6399
>                 URL: https://issues.apache.org/jira/browse/FELIX-6399
>             Project: Felix
>          Issue Type: Improvement
>          Components: System Ready
>    Affects Versions: systemready-0.4.2
>            Reporter: Carsten Ziegeler
>            Priority: Major
>             Fix For: systemready-0.4.3
>
>
> the components readycheck is each time (every 5 secs) iteration over all DS 
> components just to check for a few. The iteration includes access to the 
> service registry which (in Felix framework 6.x) has a lock
> There are two optimizations:
> - components check should only check for the configured ones instead of 
> iterating over all components just to find the ones interested in
> - the resultcan be cached until an event occurs (service changed event of the 
> SCR runtime as the runtime has a change count property to exactly avoid 
> polling)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to