org.apache.cassandra.db.ColumnFamilyStoreMBean Java Examples
The following examples show how to use
org.apache.cassandra.db.ColumnFamilyStoreMBean.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NodeTool.java From stratio-cassandra with Apache License 2.0 | 6 votes |
/** * Returns the total off heap memory used in MB. * @return the total off heap memory used in MB. */ private static double getOffHeapMemoryUsed(NodeProbe probe) { long offHeapMemUsedInBytes = 0; // get a list of column family stores Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> cfamilies = probe.getColumnFamilyStoreMBeanProxies(); while (cfamilies.hasNext()) { Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next(); String keyspaceName = entry.getKey(); String cfName = entry.getValue().getColumnFamilyName(); offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "MemtableOffHeapSize"); offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "BloomFilterOffHeapMemoryUsed"); offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "IndexSummaryOffHeapMemoryUsed"); offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "CompressionMetadataOffHeapMemoryUsed"); } return offHeapMemUsedInBytes / (1024d * 1024); }
Example #2
Source File: BackupManagerTest.java From cassandra-mesos-deprecated with Apache License 2.0 | 6 votes |
private ColumnFamilyStoreMBean newColumnFamilyStore() { return (ColumnFamilyStoreMBean) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{ColumnFamilyStoreMBean.class}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); switch (name) { case "loadNewSSTables": invocations.add("loadNewSSTables"); return null; default: throw new UnsupportedOperationException(name); } } }); }
Example #3
Source File: ColumnFamilyStoreMBeanIterator.java From cassandra-reaper with Apache License 2.0 | 5 votes |
@Override public Map.Entry<String, ColumnFamilyStoreMBean> next() { ObjectName objectName = resIter.next(); String keyspaceName = objectName.getKeyProperty("keyspace"); ColumnFamilyStoreMBean cfsProxy = JMX.newMBeanProxy(mbeanServerConn, objectName, ColumnFamilyStoreMBean.class); return new AbstractMap.SimpleImmutableEntry<>(keyspaceName, cfsProxy); }
Example #4
Source File: JmxProxyImpl.java From cassandra-reaper with Apache License 2.0 | 5 votes |
@Override public Set<Table> getTablesForKeyspace(String keyspace) throws ReaperException { final boolean canUseCompactionStrategy = versionCompare(getCassandraVersion(), "2.1") >= 0; final Set<Table> tables = new HashSet<>(); final Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> proxies; try { proxies = ColumnFamilyStoreMBeanIterator.getColumnFamilyStoreMBeanProxies(mbeanServer); } catch (IOException | MalformedObjectNameException e) { throw new ReaperException("failed to get ColumnFamilyStoreMBean instances from JMX", e); } while (proxies.hasNext()) { Map.Entry<String, ColumnFamilyStoreMBean> proxyEntry = proxies.next(); String keyspaceName = proxyEntry.getKey(); if (keyspace.equalsIgnoreCase(keyspaceName)) { ColumnFamilyStoreMBean columnFamilyMBean = proxyEntry.getValue(); Table.Builder tableBuilder = Table.builder() .withName(columnFamilyMBean.getColumnFamilyName()); if (canUseCompactionStrategy) { tableBuilder.withCompactionStrategy(columnFamilyMBean.getCompactionParameters().get("class")); } tables.add(tableBuilder.build()); } } return tables; }
Example #5
Source File: NodeProbe.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public ColumnFamilyStoreMBean getCfsProxy(String ks, String cf) { ColumnFamilyStoreMBean cfsProxy = null; try { String type = cf.contains(".") ? "IndexColumnFamilies" : "ColumnFamilies"; Set<ObjectName> beans = mbeanServerConn.queryNames( new ObjectName("org.apache.cassandra.db:type=*" + type +",keyspace=" + ks + ",columnfamily=" + cf), null); if (beans.isEmpty()) throw new MalformedObjectNameException("couldn't find that bean"); assert beans.size() == 1; for (ObjectName bean : beans) cfsProxy = JMX.newMBeanProxy(mbeanServerConn, bean, ColumnFamilyStoreMBean.class); } catch (MalformedObjectNameException mone) { System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found."); System.exit(1); } catch (IOException e) { System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found: " + e); System.exit(1); } return cfsProxy; }
Example #6
Source File: NodeProbe.java From stratio-cassandra with Apache License 2.0 | 5 votes |
private List<Entry<String, ColumnFamilyStoreMBean>> getCFSMBeans(MBeanServerConnection mbeanServerConn, String type) throws MalformedObjectNameException, IOException { ObjectName query = new ObjectName("org.apache.cassandra.db:type=" + type +",*"); Set<ObjectName> cfObjects = mbeanServerConn.queryNames(query, null); List<Entry<String, ColumnFamilyStoreMBean>> mbeans = new ArrayList<Entry<String, ColumnFamilyStoreMBean>>(cfObjects.size()); for(ObjectName n : cfObjects) { String keyspaceName = n.getKeyProperty("keyspace"); ColumnFamilyStoreMBean cfsProxy = JMX.newMBeanProxy(mbeanServerConn, n, ColumnFamilyStoreMBean.class); mbeans.add(new AbstractMap.SimpleImmutableEntry<String, ColumnFamilyStoreMBean>(keyspaceName, cfsProxy)); } return mbeans; }
Example #7
Source File: NodeTool.java From stratio-cassandra with Apache License 2.0 | 5 votes |
@Override public void execute(NodeProbe probe) { checkArgument(args.size() == 2, "getcompactionthreshold requires ks and cf args"); String ks = args.get(0); String cf = args.get(1); ColumnFamilyStoreMBean cfsProxy = probe.getCfsProxy(ks, cf); System.out.println("Current compaction thresholds for " + ks + "/" + cf + ": \n" + " min = " + cfsProxy.getMinimumCompactionThreshold() + ", " + " max = " + cfsProxy.getMaximumCompactionThreshold()); }
Example #8
Source File: ColumnFamilyStoreMBeanIterator.java From cassandra-reaper with Apache License 2.0 | 4 votes |
static Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> getColumnFamilyStoreMBeanProxies( MBeanServerConnection mbeanServerConn) throws IOException, MalformedObjectNameException { return new ColumnFamilyStoreMBeanIterator(mbeanServerConn); }
Example #9
Source File: NodeProbe.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public List<String> getSSTables(String keyspace, String cf, String key) { ColumnFamilyStoreMBean cfsProxy = getCfsProxy(keyspace, cf); return cfsProxy.getSSTablesForKey(key); }
Example #10
Source File: NodeProbe.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public Entry<String, ColumnFamilyStoreMBean> next() { return mbeans.next(); }
Example #11
Source File: NodeTool.java From stratio-cassandra with Apache License 2.0 | 4 votes |
@Override public void execute(NodeProbe probe) { checkArgument(args.size() == 2, "cfhistograms requires ks and cf args"); String keyspace = args.get(0); String cfname = args.get(1); ColumnFamilyStoreMBean store = probe.getCfsProxy(keyspace, cfname); long[] estimatedRowSizeHistogram = store.getEstimatedRowSizeHistogram(); long[] estimatedColumnCountHistogram = store.getEstimatedColumnCountHistogram(); if (ArrayUtils.isEmpty(estimatedRowSizeHistogram) || ArrayUtils.isEmpty(estimatedColumnCountHistogram)) { System.err.println("No SSTables exists, unable to calculate 'Partition Size' and 'Cell Count' percentiles"); } // calculate percentile of row size and column count String[] percentiles = new String[]{"50%", "75%", "95%", "98%", "99%", "Min", "Max"}; double[] readLatency = probe.metricPercentilesAsArray(store.getRecentReadLatencyHistogramMicros()); double[] writeLatency = probe.metricPercentilesAsArray(store.getRecentWriteLatencyHistogramMicros()); double[] estimatedRowSizePercentiles = probe.metricPercentilesAsArray(estimatedRowSizeHistogram); double[] estimatedColumnCountPercentiles = probe.metricPercentilesAsArray(estimatedColumnCountHistogram); double[] sstablesPerRead = probe.metricPercentilesAsArray(store.getRecentSSTablesPerReadHistogram()); System.out.println(format("%s/%s histograms", keyspace, cfname)); System.out.println(format("%-10s%10s%18s%18s%18s%18s", "Percentile", "SSTables", "Write Latency", "Read Latency", "Partition Size", "Cell Count")); System.out.println(format("%-10s%10s%18s%18s%18s%18s", "", "", "(micros)", "(micros)", "(bytes)", "")); for (int i = 0; i < percentiles.length; i++) { System.out.println(format("%-10s%10.2f%18.2f%18.2f%18.0f%18.0f", percentiles[i], sstablesPerRead[i], writeLatency[i], readLatency[i], estimatedRowSizePercentiles[i], estimatedColumnCountPercentiles[i])); } System.out.println(); }
Example #12
Source File: ProdJmxConnect.java From cassandra-mesos-deprecated with Apache License 2.0 | 4 votes |
@NotNull public ColumnFamilyStoreMBean getColumnFamilyStoreProxy(@NotNull final String keyspace, @NotNull final String table) { final String beanName = "org.apache.cassandra.db:type=ColumnFamilies,keyspace=" + keyspace + ",columnfamily=" + table; return newProxy(beanName, ColumnFamilyStoreMBean.class); }
Example #13
Source File: JmxConnect.java From cassandra-mesos-deprecated with Apache License 2.0 | 4 votes |
@NotNull ColumnFamilyStoreMBean getColumnFamilyStoreProxy(@NotNull String keyspace, @NotNull String table);
Example #14
Source File: TestObjectFactory.java From cassandra-mesos-deprecated with Apache License 2.0 | 4 votes |
@NotNull @Override public ColumnFamilyStoreMBean getColumnFamilyStoreProxy(@NotNull String keyspace, @NotNull String table) { return columnFamilyStore; }
Example #15
Source File: BackupManagerTest.java From cassandra-mesos-deprecated with Apache License 2.0 | 4 votes |
@NotNull @Override public ColumnFamilyStoreMBean getColumnFamilyStoreProxy(@NotNull String keyspace, @NotNull String table) { return newColumnFamilyStore(); }
Example #16
Source File: NodeProbe.java From stratio-cassandra with Apache License 2.0 | 2 votes |
/** * Set the compaction threshold * * @param minimumCompactionThreshold minimum compaction threshold * @param maximumCompactionThreshold maximum compaction threshold */ public void setCompactionThreshold(String ks, String cf, int minimumCompactionThreshold, int maximumCompactionThreshold) { ColumnFamilyStoreMBean cfsProxy = getCfsProxy(ks, cf); cfsProxy.setCompactionThresholds(minimumCompactionThreshold, maximumCompactionThreshold); }