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"));
}
}
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;
}
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);
}
};
}
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"));
}
}
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();
}
}
Aggregations