lhotari commented on PR #15155: URL: https://github.com/apache/pulsar/pull/15155#issuecomment-1104195418
> @lhotari What are the performance implications of this change? > > https://docs.oracle.com/javase/7/docs/api/java/lang/management/ThreadMXBean.html#findDeadlockedThreads() says "It might be an expensive operation." I think it may require a safepoint and can effectively pause JVM/result in the latency spikes every time health check runs (every minute?). I'd at least put it behind a feature flag. > > It is a good thing to have for the admin API/rest API to do this on demand, for troubleshooting. I don't think that there's a performance concern in this case. it takes about 50ms to run this: ```java @Test(timeOut = 5000L) public void testDeadlockDetectionOverhead() { ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); for (int i=0; i < 1000; i++) { long[] threadIds = threadBean.findDeadlockedThreads(); } } ``` The healthcheck endpoint gets called usually a few times a minute at most. The existing healthcheck is very heavyweight compared to this check that takes 50 microseconds to execute. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
