Search in sources :

Example 1 with CacheType

use of org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType in project jackrabbit-oak by apache.

the class DocumentNodeStoreService method registerJMXBeans.

private void registerJMXBeans(final DocumentNodeStore store, DocumentMK.Builder mkBuilder) throws IOException {
    addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, store.getNodeCacheStats(), CacheStatsMBean.TYPE, store.getNodeCacheStats().getName()));
    addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, store.getNodeChildrenCacheStats(), CacheStatsMBean.TYPE, store.getNodeChildrenCacheStats().getName()));
    for (CacheStats cs : store.getDiffCacheStats()) {
        addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, cs, CacheStatsMBean.TYPE, cs.getName()));
    }
    DocumentStore ds = store.getDocumentStore();
    if (ds.getCacheStats() != null) {
        for (CacheStats cacheStats : ds.getCacheStats()) {
            addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, cacheStats, CacheStatsMBean.TYPE, cacheStats.getName()));
        }
    }
    addRegistration(registerMBean(whiteboard, CheckpointMBean.class, new DocumentCheckpointMBean(store), CheckpointMBean.TYPE, "Document node store checkpoint management"));
    addRegistration(registerMBean(whiteboard, DocumentNodeStoreMBean.class, store.getMBean(), DocumentNodeStoreMBean.TYPE, "Document node store management"));
    if (mkBuilder.getBlobStoreCacheStats() != null) {
        addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, mkBuilder.getBlobStoreCacheStats(), CacheStatsMBean.TYPE, mkBuilder.getBlobStoreCacheStats().getName()));
    }
    if (mkBuilder.getDocumentStoreStatsCollector() instanceof DocumentStoreStatsMBean) {
        addRegistration(registerMBean(whiteboard, DocumentStoreStatsMBean.class, (DocumentStoreStatsMBean) mkBuilder.getDocumentStoreStatsCollector(), DocumentStoreStatsMBean.TYPE, "DocumentStore Statistics"));
    }
    // register persistent cache stats
    Map<CacheType, PersistentCacheStats> persistenceCacheStats = mkBuilder.getPersistenceCacheStats();
    for (PersistentCacheStats pcs : persistenceCacheStats.values()) {
        addRegistration(registerMBean(whiteboard, PersistentCacheStatsMBean.class, pcs, PersistentCacheStatsMBean.TYPE, pcs.getName()));
    }
    final long versionGcMaxAgeInSecs = toLong(prop(PROP_VER_GC_MAX_AGE), DEFAULT_VER_GC_MAX_AGE);
    final long blobGcMaxAgeInSecs = toLong(prop(PROP_BLOB_GC_MAX_AGE), DEFAULT_BLOB_GC_MAX_AGE);
    if (store.getBlobStore() instanceof GarbageCollectableBlobStore) {
        BlobGarbageCollector gc = store.createBlobGarbageCollector(blobGcMaxAgeInSecs, ClusterRepositoryInfo.getOrCreateId(nodeStore));
        addRegistration(registerMBean(whiteboard, BlobGCMBean.class, new BlobGC(gc, executor), BlobGCMBean.TYPE, "Document node store blob garbage collection"));
    }
    Runnable startGC = new Runnable() {

        @Override
        public void run() {
            try {
                store.getVersionGarbageCollector().gc(versionGcMaxAgeInSecs, TimeUnit.SECONDS);
            } catch (IOException e) {
                log.warn("Error occurred while executing the Version Garbage Collector", e);
            }
        }
    };
    Runnable cancelGC = new Runnable() {

        @Override
        public void run() {
            store.getVersionGarbageCollector().cancel();
        }
    };
    Supplier<String> status = new Supplier<String>() {

        @Override
        public String get() {
            return store.getVersionGarbageCollector().getStatus();
        }
    };
    RevisionGC revisionGC = new RevisionGC(startGC, cancelGC, status, executor);
    addRegistration(registerMBean(whiteboard, RevisionGCMBean.class, revisionGC, RevisionGCMBean.TYPE, "Document node store revision garbage collection"));
    BlobStoreStats blobStoreStats = mkBuilder.getBlobStoreStats();
    if (!customBlobStore && blobStoreStats != null) {
        addRegistration(registerMBean(whiteboard, BlobStoreStatsMBean.class, blobStoreStats, BlobStoreStatsMBean.TYPE, ds.getClass().getSimpleName()));
    }
    if (!mkBuilder.isBundlingDisabled()) {
        addRegistration(registerMBean(whiteboard, BackgroundObserverMBean.class, store.getBundlingConfigHandler().getMBean(), BackgroundObserverMBean.TYPE, "BundlingConfigObserver"));
    }
}
Also used : CacheType(org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType) CheckpointMBean(org.apache.jackrabbit.oak.api.jmx.CheckpointMBean) PersistentCacheStats(org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats) GarbageCollectableBlobStore(org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore) Supplier(com.google.common.base.Supplier) BlobGarbageCollector(org.apache.jackrabbit.oak.plugins.blob.BlobGarbageCollector) BlobGC(org.apache.jackrabbit.oak.plugins.blob.BlobGC) IOException(java.io.IOException) RevisionGC(org.apache.jackrabbit.oak.spi.state.RevisionGC) BlobStoreStatsMBean(org.apache.jackrabbit.oak.spi.blob.stats.BlobStoreStatsMBean) PersistentCacheStatsMBean(org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean) CacheStatsMBean(org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean) PersistentCacheStatsMBean(org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean) BlobGCMBean(org.apache.jackrabbit.oak.plugins.blob.BlobGCMBean) BlobStoreStats(org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats) CacheStats(org.apache.jackrabbit.oak.cache.CacheStats) PersistentCacheStats(org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats) RevisionGCMBean(org.apache.jackrabbit.oak.spi.state.RevisionGCMBean) BackgroundObserverMBean(org.apache.jackrabbit.oak.spi.commit.BackgroundObserverMBean)

Example 2 with CacheType

use of org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType in project jackrabbit-oak by apache.

the class DocumentNodeStoreService method registerJMXBeans.

private void registerJMXBeans(final DocumentNodeStore store, DocumentNodeStoreBuilder<?> mkBuilder) throws IOException {
    registerCacheStatsMBean(store.getNodeCacheStats());
    registerCacheStatsMBean(store.getNodeChildrenCacheStats());
    for (CacheStats cs : store.getDiffCacheStats()) {
        registerCacheStatsMBean(cs);
    }
    DocumentStore ds = store.getDocumentStore();
    if (ds.getCacheStats() != null) {
        for (CacheStats cacheStats : ds.getCacheStats()) {
            registerCacheStatsMBean(cacheStats);
        }
    }
    addRegistration(registerMBean(whiteboard, CheckpointMBean.class, new DocumentCheckpointMBean(store), CheckpointMBean.TYPE, "Document node store checkpoint management"));
    addRegistration(registerMBean(whiteboard, DocumentNodeStoreMBean.class, store.getMBean(), DocumentNodeStoreMBean.TYPE, "Document node store management"));
    if (mkBuilder.getBlobStoreCacheStats() != null) {
        registerCacheStatsMBean(mkBuilder.getBlobStoreCacheStats());
    }
    if (mkBuilder.getDocumentStoreStatsCollector() instanceof DocumentStoreStatsMBean) {
        addRegistration(registerMBean(whiteboard, DocumentStoreStatsMBean.class, (DocumentStoreStatsMBean) mkBuilder.getDocumentStoreStatsCollector(), DocumentStoreStatsMBean.TYPE, "DocumentStore Statistics"));
    }
    // register persistent cache stats
    Map<CacheType, PersistentCacheStats> persistenceCacheStats = mkBuilder.getPersistenceCacheStats();
    for (PersistentCacheStats pcs : persistenceCacheStats.values()) {
        addRegistration(registerMBean(whiteboard, PersistentCacheStatsMBean.class, pcs, PersistentCacheStatsMBean.TYPE, pcs.getName()));
    }
    final long versionGcMaxAgeInSecs = config.versionGcMaxAgeInSecs();
    final long blobGcMaxAgeInSecs = config.blobGcMaxAgeInSecs();
    if (store.getBlobStore() instanceof GarbageCollectableBlobStore) {
        BlobGarbageCollector gc = store.createBlobGarbageCollector(blobGcMaxAgeInSecs, ClusterRepositoryInfo.getOrCreateId(nodeStore), whiteboard);
        addRegistration(registerMBean(whiteboard, BlobGCMBean.class, new BlobGC(gc, executor), BlobGCMBean.TYPE, "Document node store blob garbage collection"));
    }
    Runnable startGC = new RevisionGCJob(store, versionGcMaxAgeInSecs, 0);
    Runnable cancelGC = () -> store.getVersionGarbageCollector().cancel();
    Supplier<String> status = () -> store.getVersionGarbageCollector().getStatus();
    RevisionGC revisionGC = new RevisionGC(startGC, cancelGC, status, executor);
    addRegistration(registerMBean(whiteboard, RevisionGCMBean.class, revisionGC, RevisionGCMBean.TYPE, "Document node store revision garbage collection"));
    addRegistration(registerMBean(whiteboard, RevisionGCStatsMBean.class, store.getVersionGarbageCollector().getRevisionGCStats(), RevisionGCStatsMBean.TYPE, "Document node store revision garbage collection statistics"));
    BlobStoreStats blobStoreStats = mkBuilder.getBlobStoreStats();
    if (!customBlobStore && blobStoreStats != null) {
        addRegistration(registerMBean(whiteboard, BlobStoreStatsMBean.class, blobStoreStats, BlobStoreStatsMBean.TYPE, ds.getClass().getSimpleName()));
    }
    if (!mkBuilder.isBundlingDisabled()) {
        addRegistration(registerMBean(whiteboard, BackgroundObserverMBean.class, store.getBundlingConfigHandler().getMBean(), BackgroundObserverMBean.TYPE, "BundlingConfigObserver"));
    }
}
Also used : CacheType(org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType) MongoDocumentStore(org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore) CheckpointMBean(org.apache.jackrabbit.oak.api.jmx.CheckpointMBean) PersistentCacheStats(org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats) GarbageCollectableBlobStore(org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore) BlobGarbageCollector(org.apache.jackrabbit.oak.plugins.blob.BlobGarbageCollector) BlobGC(org.apache.jackrabbit.oak.plugins.blob.BlobGC) RevisionGC(org.apache.jackrabbit.oak.spi.state.RevisionGC) BlobStoreStatsMBean(org.apache.jackrabbit.oak.spi.blob.stats.BlobStoreStatsMBean) PersistentCacheStatsMBean(org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean) BlobGCMBean(org.apache.jackrabbit.oak.plugins.blob.BlobGCMBean) BlobStoreStats(org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats) CacheStats(org.apache.jackrabbit.oak.cache.CacheStats) PersistentCacheStats(org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats) RevisionGCMBean(org.apache.jackrabbit.oak.spi.state.RevisionGCMBean) BackgroundObserverMBean(org.apache.jackrabbit.oak.spi.commit.BackgroundObserverMBean)

Aggregations

CheckpointMBean (org.apache.jackrabbit.oak.api.jmx.CheckpointMBean)2 PersistentCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean)2 CacheStats (org.apache.jackrabbit.oak.cache.CacheStats)2 BlobGC (org.apache.jackrabbit.oak.plugins.blob.BlobGC)2 BlobGCMBean (org.apache.jackrabbit.oak.plugins.blob.BlobGCMBean)2 BlobGarbageCollector (org.apache.jackrabbit.oak.plugins.blob.BlobGarbageCollector)2 BlobStoreStats (org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats)2 CacheType (org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType)2 PersistentCacheStats (org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats)2 GarbageCollectableBlobStore (org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore)2 BlobStoreStatsMBean (org.apache.jackrabbit.oak.spi.blob.stats.BlobStoreStatsMBean)2 BackgroundObserverMBean (org.apache.jackrabbit.oak.spi.commit.BackgroundObserverMBean)2 RevisionGC (org.apache.jackrabbit.oak.spi.state.RevisionGC)2 RevisionGCMBean (org.apache.jackrabbit.oak.spi.state.RevisionGCMBean)2 Supplier (com.google.common.base.Supplier)1 IOException (java.io.IOException)1 CacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean)1 MongoDocumentStore (org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore)1