You know, one of the biggest advantage of Cassandra is the high writing speed. So I wrote a test on a single Cassandra node to see what's happening. What I found is reaaaaaaaally out of my expect. Based on test result, the write speed of Cassandra is much slower than Oracle. I don't know why.
Oracle and Cassandra are both running on the same server and same disk.
In Cassandra, each row has 20 columns. The row data is like:
cassandra> get Keyspace1.Standard2['key1']
=> (column=name9, value=value19, timestamp=1279794828940)
=> (column=name8, value=value18, timestamp=1279794828940)
=> (column=name7, value=value17, timestamp=1279794828940)
=> (column=name6, value=value16, timestamp=1279794828940)
=> (column=name5, value=value15, timestamp=1279794828940)
=> (column=name4, value=value14, timestamp=1279794828940)
=> (column=name3, value=value13, timestamp=1279794828940)
=> (column=name20, value=value120, timestamp=1279794828941)
=> (column=name2, value=value12, timestamp=1279794828940)
=> (column=name19, value=value119, timestamp=1279794828941)
=> (column=name18, value=value118, timestamp=1279794828941)
=> (column=name17, value=value117, timestamp=1279794828941)
=> (column=name16, value=value116, timestamp=1279794828941)
=> (column=name15, value=value115, timestamp=1279794828941)
=> (column=name14, value=value114, timestamp=1279794828941)
=> (column=name13, value=value113, timestamp=1279794828941)
=> (column=name12, value=value112, timestamp=1279794828941)
=> (column=name11, value=value111, timestamp=1279794828940)
=> (column=name10, value=value110, timestamp=1279794828940)
=> (column=name1, value=value11, timestamp=1279794828903)
I use Java Thrift API [b]batch_insert [/b]to insert rows. You can download my code from the attachments. The Cassandra test result is:
[table]
|[b]Number of Thread[/b]| [b]rows per-thread[/b]| [b]Time esapsed[/b] | [b]Rows per-second[/b]|
|1 | 2000 | 8927 ms | 224 |
|1 | 5000 | 13854 ms | 360 |
|1 | 10000 | 20286 ms | 492 |
|1 | 20000 | 31974 ms | 625 |
|1 | 50000 | 62965 ms | 794 |
|5 | 1000 | 12401 | 403 |
|5 | 2000 | 17571 ms | 569 |
|5 | 4000 | 26202 ms | 763 |
|5 | 10000 | 50364 ms | 992 |
|10 | 1000 | 22200 ms | 450 |
|10 | 2000 | 32712 ms | 611 |
|10 | 5000 | 65625 ms | 761 |
[/table]
[b]The Oracle test result is:[/b]
[b]50000 [/b]rows are inserted
JDBC batch insert speed: [b]4000 [/b]rows persecond
JDBC single isnert speed: [b]330 [/b]row persecond
Compare the test result above, it's obviously that [b]the write speed of Oracle is much faster than Cassandra [/b]. But everybody is talking the Cassandra is very fast... I am really confused. Did I make some mistake about Cassandra setting? I only changed the path of data and commit log.
Can anybody help me?
Oracle and Cassandra are both running on the same server and same disk.
In Cassandra, each row has 20 columns. The row data is like:
cassandra> get Keyspace1.Standard2['key1']
=> (column=name9, value=value19, timestamp=1279794828940)
=> (column=name8, value=value18, timestamp=1279794828940)
=> (column=name7, value=value17, timestamp=1279794828940)
=> (column=name6, value=value16, timestamp=1279794828940)
=> (column=name5, value=value15, timestamp=1279794828940)
=> (column=name4, value=value14, timestamp=1279794828940)
=> (column=name3, value=value13, timestamp=1279794828940)
=> (column=name20, value=value120, timestamp=1279794828941)
=> (column=name2, value=value12, timestamp=1279794828940)
=> (column=name19, value=value119, timestamp=1279794828941)
=> (column=name18, value=value118, timestamp=1279794828941)
=> (column=name17, value=value117, timestamp=1279794828941)
=> (column=name16, value=value116, timestamp=1279794828941)
=> (column=name15, value=value115, timestamp=1279794828941)
=> (column=name14, value=value114, timestamp=1279794828941)
=> (column=name13, value=value113, timestamp=1279794828941)
=> (column=name12, value=value112, timestamp=1279794828941)
=> (column=name11, value=value111, timestamp=1279794828940)
=> (column=name10, value=value110, timestamp=1279794828940)
=> (column=name1, value=value11, timestamp=1279794828903)
I use Java Thrift API [b]batch_insert [/b]to insert rows. You can download my code from the attachments. The Cassandra test result is:
[table]
|[b]Number of Thread[/b]| [b]rows per-thread[/b]| [b]Time esapsed[/b] | [b]Rows per-second[/b]|
|1 | 2000 | 8927 ms | 224 |
|1 | 5000 | 13854 ms | 360 |
|1 | 10000 | 20286 ms | 492 |
|1 | 20000 | 31974 ms | 625 |
|1 | 50000 | 62965 ms | 794 |
|5 | 1000 | 12401 | 403 |
|5 | 2000 | 17571 ms | 569 |
|5 | 4000 | 26202 ms | 763 |
|5 | 10000 | 50364 ms | 992 |
|10 | 1000 | 22200 ms | 450 |
|10 | 2000 | 32712 ms | 611 |
|10 | 5000 | 65625 ms | 761 |
[/table]
[b]The Oracle test result is:[/b]
[b]50000 [/b]rows are inserted
JDBC batch insert speed: [b]4000 [/b]rows persecond
JDBC single isnert speed: [b]330 [/b]row persecond
Compare the test result above, it's obviously that [b]the write speed of Oracle is much faster than Cassandra [/b]. But everybody is talking the Cassandra is very fast... I am really confused. Did I make some mistake about Cassandra setting? I only changed the path of data and commit log.
Can anybody help me?