Search in sources :

Example 1 with Stat

use of org.apache.accumulo.core.util.Stat in project accumulo by apache.

the class IMMLGBenchmark method addStat.

private static void addStat(Map<String, Stat> stats, String s, long wt) {
    System.out.println(s + ":" + wt);
    if (stats == null)
        return;
    Stat stat = stats.get(s);
    if (stat == null) {
        stat = new Stat();
        stats.put(s, stat);
    }
    stat.addStat(wt);
}
Also used : Stat(org.apache.accumulo.core.util.Stat)

Example 2 with Stat

use of org.apache.accumulo.core.util.Stat in project accumulo by apache.

the class CollectTabletStats method calcTabletStats.

private static void calcTabletStats(Connector conn, String table, Authorizations auths, int batchSize, KeyExtent ke, String[] columns) throws Exception {
    try (Scanner scanner = conn.createScanner(table, auths)) {
        scanner.setBatchSize(batchSize);
        scanner.setRange(new Range(ke.getPrevEndRow(), false, ke.getEndRow(), true));
        for (String c : columns) {
            scanner.fetchColumnFamily(new Text(c));
        }
        Stat rowLen = new Stat();
        Stat cfLen = new Stat();
        Stat cqLen = new Stat();
        Stat cvLen = new Stat();
        Stat valLen = new Stat();
        Stat colsPerRow = new Stat();
        Text lastRow = null;
        int colsPerRowCount = 0;
        for (Entry<Key, Value> entry : scanner) {
            Key key = entry.getKey();
            Text row = key.getRow();
            if (lastRow == null) {
                lastRow = row;
            }
            if (!lastRow.equals(row)) {
                colsPerRow.addStat(colsPerRowCount);
                lastRow = row;
                colsPerRowCount = 0;
            }
            colsPerRowCount++;
            rowLen.addStat(row.getLength());
            cfLen.addStat(key.getColumnFamilyData().length());
            cqLen.addStat(key.getColumnQualifierData().length());
            cvLen.addStat(key.getColumnVisibilityData().length());
            valLen.addStat(entry.getValue().get().length);
        }
        synchronized (System.out) {
            System.out.println("");
            System.out.println("\tTablet " + ke.getUUID() + " statistics : ");
            printStat("Row length", rowLen);
            printStat("Column family length", cfLen);
            printStat("Column qualifier length", cqLen);
            printStat("Column visibility length", cvLen);
            printStat("Value length", valLen);
            printStat("Columns per row", colsPerRow);
            System.out.println("");
        }
    }
}
Also used : Scanner(org.apache.accumulo.core.client.Scanner) Stat(org.apache.accumulo.core.util.Stat) Value(org.apache.accumulo.core.data.Value) Text(org.apache.hadoop.io.Text) Range(org.apache.accumulo.core.data.Range) Key(org.apache.accumulo.core.data.Key)

Example 3 with Stat

use of org.apache.accumulo.core.util.Stat in project accumulo by apache.

the class CollectTabletStats method calcTabletStats.

private static void calcTabletStats(AccumuloClient client, String table, Authorizations auths, KeyExtent ke, String[] columns) throws Exception {
    try (Scanner scanner = client.createScanner(table, auths)) {
        scanner.setRange(new Range(ke.prevEndRow(), false, ke.endRow(), true));
        for (String c : columns) {
            scanner.fetchColumnFamily(new Text(c));
        }
        Stat rowLen = new Stat();
        Stat cfLen = new Stat();
        Stat cqLen = new Stat();
        Stat cvLen = new Stat();
        Stat valLen = new Stat();
        Stat colsPerRow = new Stat();
        Text lastRow = null;
        int colsPerRowCount = 0;
        for (Entry<Key, Value> entry : scanner) {
            Key key = entry.getKey();
            Text row = key.getRow();
            if (lastRow == null) {
                lastRow = row;
            }
            if (!lastRow.equals(row)) {
                colsPerRow.addStat(colsPerRowCount);
                lastRow = row;
                colsPerRowCount = 0;
            }
            colsPerRowCount++;
            rowLen.addStat(row.getLength());
            cfLen.addStat(key.getColumnFamilyData().length());
            cqLen.addStat(key.getColumnQualifierData().length());
            cvLen.addStat(key.getColumnVisibilityData().length());
            valLen.addStat(entry.getValue().get().length);
        }
        synchronized (System.out) {
            System.out.println("");
            System.out.println("\tTablet " + ke.getUUID() + " statistics : ");
            printStat("Row length", rowLen);
            printStat("Column family length", cfLen);
            printStat("Column qualifier length", cqLen);
            printStat("Column visibility length", cvLen);
            printStat("Value length", valLen);
            printStat("Columns per row", colsPerRow);
            System.out.println("");
        }
    }
}
Also used : Scanner(org.apache.accumulo.core.client.Scanner) Stat(org.apache.accumulo.core.util.Stat) Value(org.apache.accumulo.core.data.Value) Text(org.apache.hadoop.io.Text) Range(org.apache.accumulo.core.data.Range) Key(org.apache.accumulo.core.data.Key)

Example 4 with Stat

use of org.apache.accumulo.core.util.Stat in project accumulo by apache.

the class TestScanInfo method getIdleTimeStats.

@Override
public Stats getIdleTimeStats(long currentTime) {
    Stat copy = idleTimeStats.copy();
    copy.addStat(currentTime - lastRunTime.orElse(creationTime));
    return copy;
}
Also used : Stat(org.apache.accumulo.core.util.Stat)

Example 5 with Stat

use of org.apache.accumulo.core.util.Stat in project accumulo by apache.

the class IMMLGBenchmark method main.

public static void main(String[] args) throws Exception {
    ZooKeeperInstance zki = new ZooKeeperInstance(ClientConfiguration.create().withInstance("test16").withZkHosts("localhost"));
    Connector conn = zki.getConnector("root", new PasswordToken("secret"));
    int numlg = Integer.parseInt(args[0]);
    ArrayList<byte[]> cfset = new ArrayList<>();
    for (int i = 0; i < 32; i++) {
        cfset.add(String.format("%04x", i).getBytes());
    }
    Map<String, Stat> stats = new TreeMap<>();
    for (int i = 0; i < 5; i++) {
        runTest(conn, numlg, cfset, i > 1 ? stats : null);
        System.out.println();
    }
    for (Entry<String, Stat> entry : stats.entrySet()) {
        System.out.printf("%20s : %6.2f\n", entry.getKey(), entry.getValue().getAverage());
    }
}
Also used : Connector(org.apache.accumulo.core.client.Connector) PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) Stat(org.apache.accumulo.core.util.Stat) ArrayList(java.util.ArrayList) TreeMap(java.util.TreeMap) ZooKeeperInstance(org.apache.accumulo.core.client.ZooKeeperInstance)

Aggregations

Stat (org.apache.accumulo.core.util.Stat)6 Scanner (org.apache.accumulo.core.client.Scanner)2 Key (org.apache.accumulo.core.data.Key)2 Range (org.apache.accumulo.core.data.Range)2 Value (org.apache.accumulo.core.data.Value)2 Text (org.apache.hadoop.io.Text)2 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 Connector (org.apache.accumulo.core.client.Connector)1 ZooKeeperInstance (org.apache.accumulo.core.client.ZooKeeperInstance)1 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)1