Search in sources :

Example 1 with JMXEnabledThreadPoolExecutorMBean

use of org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutorMBean in project eiger by wlloyd.

the class StatusLogger method log.

public static void log() {
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();
    // everything from o.a.c.concurrent
    logger.info(String.format("%-25s%10s%10s%10s", "Pool Name", "Active", "Pending", "Blocked"));
    Set<ObjectName> request, internal;
    try {
        request = server.queryNames(new ObjectName("org.apache.cassandra.request:type=*"), null);
        internal = server.queryNames(new ObjectName("org.apache.cassandra.internal:type=*"), null);
    } catch (MalformedObjectNameException e) {
        throw new RuntimeException(e);
    }
    for (ObjectName objectName : Iterables.concat(request, internal)) {
        String poolName = objectName.getKeyProperty("type");
        JMXEnabledThreadPoolExecutorMBean threadPoolProxy = JMX.newMBeanProxy(server, objectName, JMXEnabledThreadPoolExecutorMBean.class);
        logger.info(String.format("%-25s%10s%10s%10s", poolName, threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(), threadPoolProxy.getCurrentlyBlockedTasks()));
    }
    // one offs
    logger.info(String.format("%-25s%10s%10s", "CompactionManager", "n/a", CompactionManager.instance.getPendingTasks()));
    int pendingCommands = 0;
    for (int n : MessagingService.instance().getCommandPendingTasks().values()) {
        pendingCommands += n;
    }
    int pendingResponses = 0;
    for (int n : MessagingService.instance().getResponsePendingTasks().values()) {
        pendingResponses += n;
    }
    logger.info(String.format("%-25s%10s%10s", "MessagingService", "n/a", pendingCommands + "," + pendingResponses));
    // Global key/row cache information
    AutoSavingCache<KeyCacheKey, Long> keyCache = CacheService.instance.keyCache;
    AutoSavingCache<RowCacheKey, ColumnFamily> rowCache = CacheService.instance.rowCache;
    int keyCacheKeysToSave = DatabaseDescriptor.getKeyCacheKeysToSave();
    int rowCacheKeysToSave = DatabaseDescriptor.getRowCacheKeysToSave();
    logger.info(String.format("%-25s%10s%25s%25s%65s", "Cache Type", "Size", "Capacity", "KeysToSave", "Provider"));
    logger.info(String.format("%-25s%10s%25s%25s%65s", "KeyCache", keyCache.weightedSize(), keyCache.getCapacity(), keyCacheKeysToSave == Integer.MAX_VALUE ? "all" : keyCacheKeysToSave, ""));
    logger.info(String.format("%-25s%10s%25s%25s%65s", "RowCache", rowCache.weightedSize(), rowCache.getCapacity(), rowCacheKeysToSave == Integer.MAX_VALUE ? "all" : rowCacheKeysToSave, DatabaseDescriptor.getRowCacheProvider().getClass().getName()));
    // per-CF stats
    logger.info(String.format("%-25s%20s", "ColumnFamily", "Memtable ops,data"));
    for (ColumnFamilyStore cfs : ColumnFamilyStore.all()) {
        logger.info(String.format("%-25s%20s", cfs.table.name + "." + cfs.columnFamily, cfs.getMemtableColumnsCount() + "," + cfs.getMemtableDataSize()));
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) JMXEnabledThreadPoolExecutorMBean(org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutorMBean) KeyCacheKey(org.apache.cassandra.cache.KeyCacheKey) ObjectName(javax.management.ObjectName) ColumnFamily(org.apache.cassandra.db.ColumnFamily) ColumnFamilyStore(org.apache.cassandra.db.ColumnFamilyStore) RowCacheKey(org.apache.cassandra.cache.RowCacheKey) MBeanServer(javax.management.MBeanServer)

Example 2 with JMXEnabledThreadPoolExecutorMBean

use of org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutorMBean in project eiger by wlloyd.

the class NodeCmd method printThreadPoolStats.

public void printThreadPoolStats(PrintStream outs) {
    outs.printf("%-25s%10s%10s%15s%10s%18s%n", "Pool Name", "Active", "Pending", "Completed", "Blocked", "All time blocked");
    Iterator<Map.Entry<String, JMXEnabledThreadPoolExecutorMBean>> threads = probe.getThreadPoolMBeanProxies();
    while (threads.hasNext()) {
        Entry<String, JMXEnabledThreadPoolExecutorMBean> thread = threads.next();
        String poolName = thread.getKey();
        JMXEnabledThreadPoolExecutorMBean threadPoolProxy = thread.getValue();
        outs.printf("%-25s%10s%10s%15s%10s%18s%n", poolName, threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(), threadPoolProxy.getCompletedTasks(), threadPoolProxy.getCurrentlyBlockedTasks(), threadPoolProxy.getTotalBlockedTasks());
    }
    outs.printf("%n%-20s%10s%n", "Message type", "Dropped");
    for (Entry<String, Integer> entry : probe.getDroppedMessages().entrySet()) outs.printf("%-20s%10s%n", entry.getKey(), entry.getValue());
}
Also used : Entry(java.util.Map.Entry) JMXEnabledThreadPoolExecutorMBean(org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutorMBean)

Aggregations

JMXEnabledThreadPoolExecutorMBean (org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutorMBean)2 Entry (java.util.Map.Entry)1 MBeanServer (javax.management.MBeanServer)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ObjectName (javax.management.ObjectName)1 KeyCacheKey (org.apache.cassandra.cache.KeyCacheKey)1 RowCacheKey (org.apache.cassandra.cache.RowCacheKey)1 ColumnFamily (org.apache.cassandra.db.ColumnFamily)1 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)1