AnsweredAssumed Answered

Improve write speeds into MapR-DB using Java API

Question asked by vchittireddy on Oct 6, 2017
Latest reply on Oct 18, 2017 by MichaelSegel

I'm inserting data into MapR-DB consumed from MapR Streams. My implementation of put into MapR DB looks like this:

public static void put(String tableName, String rowkey, String columnFamily, Map<String,String> data)
            throws IOException {
        TableName tn = TableName.valueOf(tableName);
        Table table = conn.getTable(tn);
        Put put = new Put(Bytes.toBytes(rowkey));
        Iterator iterator = data.entrySet().iterator();
        while(iterator.hasNext()) {
            Map.Entry<String,String> entry = (Entry<String,String>);
        put.addColumn(Bytes.toBytes(columnFamily), Bytes.toBytes(entry.getKey()), Bytes.toBytes(entry.getValue()));

The current write speeds with this implementation is about 30 Records a second, which is pretty low for real-time stream consumption. This current code is running in my Eclipse IDE on my Mac. I'm connecting to the cluster using MapR Client. How can I speed up the writes? I'm looking at improving it by 20x.