Search in sources :

Example 1 with BlobStoreStats

use of org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats 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 BlobStoreStats

use of org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats in project jackrabbit-oak by apache.

the class LuceneWritesOnSegmentStatsTest method createBlobStore.

private BlobStore createBlobStore() {
    FileDataStore fds = new OakFileDataStore();
    fdsDir = "target/fds-" + codec + copyOnRW + minRecordLength + mergePolicy;
    fds.setPath(fdsDir);
    if (minRecordLength > 0) {
        fds.setMinRecordLength(minRecordLength);
    }
    fds.init(null);
    dataStoreBlobStore = new DataStoreBlobStore(fds);
    StatisticsProvider sp = new DefaultStatisticsProvider(scheduledExecutorService);
    BlobStatsCollector collector = new BlobStoreStats(sp);
    dataStoreBlobStore.setBlobStatsCollector(collector);
    return dataStoreBlobStore;
}
Also used : OakFileDataStore(org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore) BlobStatsCollector(org.apache.jackrabbit.oak.spi.blob.stats.BlobStatsCollector) BlobStoreStats(org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats) DefaultStatisticsProvider(org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider) FileDataStore(org.apache.jackrabbit.core.data.FileDataStore) OakFileDataStore(org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore) DefaultStatisticsProvider(org.apache.jackrabbit.oak.stats.DefaultStatisticsProvider) StatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)

Example 3 with BlobStoreStats

use of org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats in project jackrabbit-oak by apache.

the class BlobStoreFixture method getFileDataStore.

public static BlobStoreFixture getFileDataStore(final File basedir, final int fdsCacheInMB, final StatisticsProvider statisticsProvider) {
    return new BlobStoreFixture("FDS") {

        private File storeDir;

        private FileDataStore fds;

        @Override
        public BlobStore setUp() {
            fds = new FileDataStore();
            fds.setMinRecordLength(4092);
            storeDir = new File(basedir, unique);
            fds.init(storeDir.getAbsolutePath());
            configure(fds);
            DataStoreBlobStore bs = new DataStoreBlobStore(fds, true, fdsCacheInMB);
            bs.setBlobStatsCollector(new BlobStoreStats(statisticsProvider));
            configure(bs);
            return bs;
        }

        @Override
        public void tearDown() {
            fds.close();
            FileUtils.deleteQuietly(storeDir);
        }

        @Override
        public long size() {
            return FileUtils.sizeOfDirectory(storeDir);
        }
    };
}
Also used : BlobStoreStats(org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats) File(java.io.File) FileDataStore(org.apache.jackrabbit.core.data.FileDataStore) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)

Example 4 with BlobStoreStats

use of org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats 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)

Example 5 with BlobStoreStats

use of org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats in project jackrabbit-oak by apache.

the class DocumentNodeStoreBuilder method configureBlobStore.

/**
 * BlobStore which are created by builder might get wrapped.
 * So here we perform any configuration and also access any
 * service exposed by the store
 *
 * @param blobStore store to config
 */
private void configureBlobStore(BlobStore blobStore) {
    if (blobStore instanceof AbstractBlobStore) {
        this.blobStoreStats = new BlobStoreStats(statisticsProvider);
        ((AbstractBlobStore) blobStore).setStatsCollector(blobStoreStats);
    }
    if (blobStore instanceof CachingBlobStore) {
        blobStoreCacheStats = ((CachingBlobStore) blobStore).getCacheStats();
    }
}
Also used : AbstractBlobStore(org.apache.jackrabbit.oak.spi.blob.AbstractBlobStore) BlobStoreStats(org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats) CachingBlobStore(org.apache.jackrabbit.oak.plugins.blob.CachingBlobStore)

Aggregations

BlobStoreStats (org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats)6 FileDataStore (org.apache.jackrabbit.core.data.FileDataStore)2 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 DataStoreBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)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 File (java.io.File)1 IOException (java.io.IOException)1 Hashtable (java.util.Hashtable)1