Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CockroachDB performance is much worse than mongoDB and Aurora?

I am doing some basic load testing against cockroachDB, mongoDB and Aurora. I just have a project which can keep read/write into one of those three DBs. In that project, we can configure groutine numbers about read/write so that we can mimic different test scenarios: read-heavy, write-heavy, balanced.

The result shows cockroachDB's performance is terrible compared to another two. I don't expected cockroachDB performance is that bad. Wondering some tricky settings may be needed to be configured for cockroachDB. Any suggestions? Thanks forks!

enter image description here

Balanced traffic: 500 write: 500 read. This is the avg operation per second:

  • Mongo_read: 44.6k/s
  • Aurora_read: 33.6k/s
  • Aurora_insert: 14.3k/s
  • Mongo_insert: 2.6k/s
  • Crdb_insert: 2.6k/s
  • Crdb_read: 2.3k/s

Heavy write traffic: 1000 write: 100 read. This is the avg operation per second:

  • Aurora_read: 40.5k/s
  • Aurora_insert: 10.5k/s
  • Mongo_insert: 10.4k/s
  • Mongo_read: 10.2k/s
  • Crdb_insert: 3.8k/s
  • Crdb_read: 0.6k/s

Heavy write traffic: 100 write: 1000 read. This is the avg operation per second:

  • Aurora_read: 69.8k/s
  • Mongo_read: 46.7k/s
  • Crdb_read: 8k/s
  • Aurora_insert: 7k/s
  • Mongo_insert: 0.8k/s
  • Crdb_insert: 0.7k/s
like image 865
xiaoyaoworm Avatar asked Feb 02 '26 19:02

xiaoyaoworm


1 Answers

The default transaction isolation level in cockroachDB is SERIALIZABLE, which is stronger than Aurora's default transaction isolation level of "REPEATABLE_READ", which explains the reduced write performance under load. CockroachDB is doing extra work to "coordinate" the write transactions, ordering them in a way that produces an output as if they were executed in sequence. From the CockroachDB docs:

"In contrast to most databases, CockroachDB offers SERIALIZABLE isolation by default, which is the strongest of the four transaction isolation levels defined by the SQL standard and is stronger than the SNAPSHOT isolation level developed later. SERIALIZABLE isolation guarantees that even though transactions may execute in parallel, the result is the same as if they had executed one at a time, without any concurrency. This ensures data correctness by preventing all "anomalies" allowed by weaker isolation levels."

like image 92
mancini0 Avatar answered Feb 04 '26 15:02

mancini0