Question

I am new to cassandra and migrating my application from Mysql to cassandra.As i read of cassandra it says it reduces the read and write time compared to Mysql.when i tried a simple example with single node using hector, reading operation is quite faster compared to Mysql,and if i tried to insert a single column it is very fast compared to mysql.But when i tried to insert a single row with multiple columns its taking long time compared to mysql. Is there anyway to improve Write performance or please let me know if i am wrong with my way of coding.

My sql code is INSERT into energy_usage(meter_id,reading_datetime,reading_date,reading_time,asset_id,assetid) VALUES('164','2012-12-07 00:30:00','2012-12-07','00:00:00','1','1') " my cassandra code is

Mutator<String> mutator = HFactory.createMutator(keyspaceOperator, StringSerializer.get());
        mutator.addInsertion("888999", DYN_CF, HFactory.createStringColumn("assetid","1")).
            addInsertion("888999", DYN_CF, HFactory.createStringColumn("meterid", "164")).
            addInsertion("888999", DYN_CF, HFactory.createStringColumn("energyusage","10")).
            addInsertion("888999", DYN_CF, HFactory.createStringColumn("readdate","2012-12-07")).
            addInsertion("888999", DYN_CF, HFactory.createStringColumn("readdatetime","2012-12-07 00:30:00"));
                mutator.execute();
Was it helpful?

Solution

Well, if you can provide us with some benchmarks stating what do you find as 'very slow', maybe we can help you further. But one important thing is to note that a cassandra feature is that as the amount of data in your cluster grows, you are guaranteed (loosely) to get somewhat more constant read/write performance times as compared to a relational db engine.

Have you tried executing the same query in a cassandra-cli/cqlsh, for example? What kind of performance do you get then? If the difference between the cassandra-cli/cqlsh statement and the piece of code you posted is dramatic, that means that it is probably a driver issue, so I would dig deeper in Hector code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top