wu-sheng commented on a change in pull request #4220: [WIP] sniffer processing profile task and report status and snapshot URL: https://github.com/apache/skywalking/pull/4220#discussion_r365710705
########## File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/profile/ProfileTaskExecutionService.java ########## @@ -38,13 +45,17 @@ * @author MrPro */ @DefaultImplementor -public class ProfileTaskExecutionService implements BootService { +public class ProfileTaskExecutionService implements BootService, TracingContextListener { private static final ILog logger = LogManager.getLogger(ProfileTaskExecutionService.class); // add a schedule while waiting for the task to start or finish private final static ScheduledExecutorService PROFILE_TASK_SCHEDULE = Executors.newSingleThreadScheduledExecutor(new DefaultNamedThreadFactory("PROFILE-TASK-SCHEDULE")); + // profiling segment thread array, Config.Profile.PARALLELS_THREAD_COUNT + private final static ProfilingThread[] PROFILING_THREADS = new ProfilingThread[Config.Profile.PARALLELS_THREAD_COUNT]; Review comment: Are you creating so many threads for profiling tasks? I prefer to do this by using only one thread only. And don't create and dispose the thread every time. This is dangerous for JVM from my understanding. @kezhenxu94 @arugal what do you think? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services