Search in sources :

Example 1 with StatsConfig

use of com.sleepycat.je.StatsConfig in project qpid-broker-j by apache.

the class EnvironmentUtils method getTransactionStatistics.

public static Map<String, Object> getTransactionStatistics(Environment environment, boolean reset) {
    StatsConfig config = new StatsConfig();
    config.setClear(reset);
    config.setFast(false);
    final TransactionStats stats = environment.getTransactionStats(config);
    Map<String, Object> results = new LinkedHashMap<>();
    results.put(TXN_ACTIVE.getName(), stats.getNActive());
    results.put(TXN_BEGINS.getName(), stats.getNBegins());
    results.put(TXN_COMMITS.getName(), stats.getNCommits());
    results.put(TXN_ABORTS.getName(), stats.getNAborts());
    results.put(TXN_XAPREPARES.getName(), stats.getNXAPrepares());
    results.put(TXN_XACOMMITS.getName(), stats.getNXACommits());
    results.put(TXN_XAABORTS.getName(), stats.getNXAAborts());
    return results;
}
Also used : TransactionStats(com.sleepycat.je.TransactionStats) StatsConfig(com.sleepycat.je.StatsConfig) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with StatsConfig

use of com.sleepycat.je.StatsConfig in project voldemort by voldemort.

the class BdbStorageEngine method getStats.

public DatabaseStats getStats(boolean setFast) {
    try {
        StatsConfig config = new StatsConfig();
        config.setFast(setFast);
        return this.getBdbDatabase().getStats(config);
    } catch (DatabaseException e) {
        this.bdbEnvironmentStats.reportException(e);
        logger.error(e);
        throw new VoldemortException(e);
    }
}
Also used : StatsConfig(com.sleepycat.je.StatsConfig) DatabaseException(com.sleepycat.je.DatabaseException) VoldemortException(voldemort.VoldemortException)

Example 3 with StatsConfig

use of com.sleepycat.je.StatsConfig in project voldemort by voldemort.

the class BdbEnvironmentStats method getEnvironmentStats.

private EnvironmentStats getEnvironmentStats(boolean fast) {
    StatsConfig config = new StatsConfig();
    config.setFast(fast);
    return environment.getStats(config);
}
Also used : StatsConfig(com.sleepycat.je.StatsConfig)

Example 4 with StatsConfig

use of com.sleepycat.je.StatsConfig in project voldemort by voldemort.

the class BdbSplitStorageEngineTest method getMaxCacheUsage.

private long getMaxCacheUsage(EnvironmentConfig environmentConfig, DatabaseConfig databaseConfig) throws DatabaseException {
    File dirA = new File(bdbMasterDir + "/" + "storeA");
    if (!dirA.exists()) {
        dirA.mkdirs();
    }
    Environment environmentA = new Environment(dirA, environmentConfig);
    Database databaseA = environmentA.openDatabase(null, "storeA", databaseConfig);
    BdbStorageEngine storeA = BdbStorageEngineTest.makeBdbStorageEngine("storeA", environmentA, databaseA, new BdbRuntimeConfig(), this.prefixPartitionId);
    File dirB = new File(bdbMasterDir + "/" + "storeB");
    if (!dirB.exists()) {
        dirB.mkdirs();
    }
    Environment environmentB = new Environment(dirB, environmentConfig);
    Database databaseB = environmentB.openDatabase(null, "storeB", databaseConfig);
    BdbStorageEngine storeB = BdbStorageEngineTest.makeBdbStorageEngine("storeB", environmentB, databaseB, new BdbRuntimeConfig(), this.prefixPartitionId);
    long maxCacheUsage = 0;
    for (int i = 0; i <= 10000; i++) {
        byte[] value = new byte[(int) (CACHE_SIZE / 10000)];
        // try to push values in cache
        storeA.put(TestUtils.toByteArray(i + "A"), new Versioned<byte[]>(value), null);
        storeA.get(TestUtils.toByteArray(i + "A"), null);
        storeB.put(TestUtils.toByteArray(i + "B"), new Versioned<byte[]>(value), null);
        storeB.get(TestUtils.toByteArray(i + "B"), null);
        EnvironmentStats statsA = environmentA.getStats(new StatsConfig());
        EnvironmentStats statsB = environmentB.getStats(new StatsConfig());
        long totalCacheSize = statsA.getCacheTotalBytes() + statsB.getCacheTotalBytes();
        System.out.println("A.size:" + statsA.getCacheTotalBytes() + " B.size:" + statsB.getCacheTotalBytes() + " total:" + totalCacheSize + " max:" + maxCacheUsage + " cacheMax:" + environmentA.getConfig().getCacheSize());
        System.out.println("Shared.A:" + statsA.getSharedCacheTotalBytes() + " nSharedEnv:" + statsA.getNSharedCacheEnvironments());
        maxCacheUsage = Math.max(maxCacheUsage, totalCacheSize);
    }
    return maxCacheUsage;
}
Also used : StatsConfig(com.sleepycat.je.StatsConfig) Database(com.sleepycat.je.Database) Environment(com.sleepycat.je.Environment) EnvironmentStats(com.sleepycat.je.EnvironmentStats) File(java.io.File)

Example 5 with StatsConfig

use of com.sleepycat.je.StatsConfig in project qpid-broker-j by apache.

the class EnvironmentUtils method getEnvironmentStatistics.

public static Map<String, Map<String, Object>> getEnvironmentStatistics(Environment environment, boolean reset) {
    StatsConfig config = new StatsConfig();
    config.setClear(reset);
    config.setFast(false);
    EnvironmentStats stats = environment.getStats(config);
    Collection<StatGroup> statGroups = stats.getStatGroups();
    return getStatsFromStatGroup(statGroups);
}
Also used : StatsConfig(com.sleepycat.je.StatsConfig) EnvironmentStats(com.sleepycat.je.EnvironmentStats) StatGroup(com.sleepycat.je.utilint.StatGroup)

Aggregations

StatsConfig (com.sleepycat.je.StatsConfig)8 Database (com.sleepycat.je.Database)2 DatabaseException (com.sleepycat.je.DatabaseException)2 Environment (com.sleepycat.je.Environment)2 EnvironmentStats (com.sleepycat.je.EnvironmentStats)2 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)2 VoldemortException (voldemort.VoldemortException)2 BtreeStats (com.sleepycat.je.BtreeStats)1 DatabaseConfig (com.sleepycat.je.DatabaseConfig)1 TransactionStats (com.sleepycat.je.TransactionStats)1 StatGroup (com.sleepycat.je.utilint.StatGroup)1 File (java.io.File)1 LinkedHashMap (java.util.LinkedHashMap)1 TreeMap (java.util.TreeMap)1