For now, thread pool metrics register after all GridComponent starts.
But there are specific scenarios when some component blocks onKernalStart execution for a long time. GridCacheProcessor can be taken as an example.
This leads to the situation when some metric info is lost.
Seems, we can register thread pool metrics right after only *required* components are started and don't wait for all components.
// Callbacks. for (GridComponent comp : ctx) { comp.onKernalStart(active); } // Start plugins. for (PluginProvider provider : ctx.plugins().allProviders()) provider.onIgniteStart(); ctx.metric().registerThreadPools(utilityCachePool, execSvc, svcExecSvc, sysExecSvc, stripedExecSvc, p2pExecSvc, mgmtExecSvc, igfsExecSvc, dataStreamExecSvc, restExecSvc, affExecSvc, idxExecSvc, callbackExecSvc, qryExecSvc, schemaExecSvc, rebalanceExecSvc, rebalanceStripedExecSvc, customExecSvcs); // Register MBeans. mBeansMgr.registerAllMBeans(utilityCachePool, execSvc, svcExecSvc, sysExecSvc, stripedExecSvc, p2pExecSvc, mgmtExecSvc, igfsExecSvc, dataStreamExecSvc, restExecSvc, affExecSvc, idxExecSvc, callbackExecSvc, qryExecSvc, schemaExecSvc, rebalanceExecSvc, rebalanceStripedExecSvc, customExecSvcs, ctx.workersRegistry());
public class GridCacheProcessor { @Override public void onKernalStart(boolean active) throws IgniteCheckedException { //..... final List<IgniteInternalFuture> syncFuts = new ArrayList<>(caches.size()); sharedCtx.forAllCaches(new CIX1<GridCacheContext>() { @Override public void applyx(GridCacheContext cctx) { CacheConfiguration cfg = cctx.config(); if (cctx.affinityNode() && cfg.getRebalanceMode() == SYNC && startTopVer.equals(cctx.startTopologyVersion())) { CacheMode cacheMode = cfg.getCacheMode(); if (cacheMode == REPLICATED || (cacheMode == PARTITIONED && cfg.getRebalanceDelay() >= 0)) // Need to wait outside to avoid a deadlock syncFuts.add(cctx.preloader().syncFuture()); } } }); for (int i = 0, size = syncFuts.size(); i < size; i++) syncFuts.get(i).get();
- links to