MySql Vs CockroachDB performance Test


(hrishikesh srivastava) #1

Hi,

We recently migrated our application with cockroachDB. Earlier application was using MySQL.

I have a concern regarding Query performance. I am using Apache JMeter for testing.
While I am sending 500 requests with single user via JMeter, I got following results: -

Using CockroachDB:

Avg Transaction processing time: 1465ms
Number of Cockroach Nodes: 3
Deviation:619

Using MySql:

Avg Transaction processing time: 631ms
Deviation:619

So, as a conclusion, I think MySql is winner in terms of Performance.

Is there a way to improve my application processing time with CockroachDB? In application,I am using Java JPA for CRUD operation.


(Matt Jibson) #2

A distributed system like cockroach can’t be as fast at single transaction processing due to the realities that it must wait for a quorum of machines (at least 2) to acknowledge writes before returning to the client, including some network latency between machines. Cockroach has other benefits like horizontal scaling, geo-distributed servers, fault tolerance, etc. These are tradeoffs you’ll have to choose based on your needs.

Can you share your workload, though? There may be some schema design or query improvements that can be made to make the existing queries faster.


(hrishikesh srivastava) #3

Hey @mjibson,

sorry for late response. I agree with you. However still few queries/doubts:

Does Cockroach respond back after replicating data to all the nodes? What I am assuming that once it write data to first node, it immediately respond back and behind the scene it continue it replication to other nodes.

For example, lets assume that I am using 15 nodes and executed one query via my application. So, will I get response after it replicated to all nodes or immediately after first node update?


(Matt Jibson) #4

Responses come after a quorum (usually 2 of 3) nodes have written data to disk. https://www.cockroachlabs.com/docs/v2.1/architecture/replication-layer.html describes how this works in detail.


(hrishikesh srivastava) #5

Can we calculate replication delay between two nodes? lets assume there is 30 miles different between two nodes.


(Matt Jibson) #6

You’ll have to use your networking tools to do that.