+ All Categories
Home > Documents > Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL...

Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL...

Date post: 08-Oct-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
50
1 © 2020 All rights reserved. Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte
Transcript
Page 1: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

1 © 2020 All rights reserved.

Evaluating CockroachDB vs YugabyteDBPostgreSQL features, architecture, benchmarks

Karthik Ranganathan, Co-founder/CTO, Yugabyte

Page 2: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

2 © 2020 All rights reserved.

Distributed SQL databases

SQL capabilities + resilient to failures + scalable + geo-distributed

vs

Page 3: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

3 © 2020 All rights reserved.

is a distributed SQL database built for:

● high performance (low Latency)

● cloud native (run on Kubernetes, VMs, bare metal)

● open source (Apache 2.0)

Page 4: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

4 © 2020 All rights reserved.

Evaluation Criteria

● RDBMS feature support

● Performance - using YCSB

● At-scale performance

● Architectural takeaways

● Licensing model

In parallel, we’ll also look at architectural differences.

Page 5: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

5© 2020 All rights reserved.

RDBMS Feature Support

Page 6: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

6 © 2020 All rights reserved.

Both DBs support PostgreSQL wire-protocol

However, there are architectural differences

Page 7: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

7 © 2020 All rights reserved.

● Reuses PostgreSQL codebase ● Rewritten SQL layer

Page 8: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

8© 2020 All rights reserved.

Reusing PostgreSQL vs Rewriting

Page 9: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

9 © 2020 All rights reserved.

Cockroach Labs blog post:

Yugabyte uses PostgreSQL for SQL optimization, and a portion of execution.

Reusing PostgreSQL results in monolithic SQL architecture

INCORRECT!

Page 10: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

10 © 2020 All rights reserved.

How YugabyteDB is architected:

Enhancing PostgreSQL to a distributed architecture is being accomplished in three phases:

● SQL layer on distributed DB● Perform more SQL pushdowns● Enhance optimizer

Page 11: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

11© 2020 All rights reserved.

Phase #1 - SQL layer on distributed DB

Page 12: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

12© 2020 All rights reserved.

Phase #2: Perform SQL Pushdowns

Page 13: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

13© 2020 All rights reserved.

Phase #3: Enhance PostgreSQL Optimizer

• Table statistics based hints• Piggyback on current PostgreSQL optimizer that uses table statistics

• Geographic location based hints• Based on “network” cost• Factors in network latency between nodes and tablet placement

• Rewriting query plan for distributed SQL• Extend PostgreSQL “plan nodes” for distributed execution

Page 14: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

14© 2020 All rights reserved.

Advantages of reusing PostgreSQL

PostgreSQL regression tests currently in YugabyteDB.

Aim: get to 100% coverage

● Support advanced RDBMS features

● Robust design, code, documentation by PostgreSQL

● Keep quality high

Page 15: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

15© 2020 All rights reserved.

PerformanceUsing YCSB

Page 16: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

16 © 2020 All rights reserved.

YCSB Benchmark Comparison

YSQL 2.0 results (reported by Cockroach Labs)

CRDB v19.2.0 results(reported by Cockroach Labs with custom driver)

YSQL 2.1 results(reported by Yugabyte with custom driver)

YCQL 2.1 results(reported by Yugabyte with standard driver)

Page 17: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

17 © 2020 All rights reserved.

YugabyteDB takeaways

● YSQL perf dramatically increased from v2.0 to v2.1

● YCQL performance is much higher

● Over time, YSQL perf will match that of YCQL

Page 18: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

18 © 2020 All rights reserved.

Overall takeaways

● Issue #1: vendor-specific benchmarks are hard to run

● Issue #2: These benchmarks have too little data

● Repeat at scale:○ Use standard YCSB driver with JDBC binding○ Use large datasets to understand perf at scale

Page 19: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

19© 2020 All rights reserved.

Performance at scaleYCSB with 450M rows

Page 20: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

20 © 2020 All rights reserved.

Benchmark details450M rows (~1.3TB) loaded using the YCSB benchmark

● 3 node cluster, replication factor = 3 (in AWS, us-west-2)

● Each node was c5.4xlarge (16 vCPU, 2 x 5TB gp2 EBS SSD)

● CockroachDB v19.2.6 (range sharding, hash not GA at the time)

● YugabyteDB v2.1 (using YSQL, range and hash sharding)

● Default isolation levels for both DBs

Page 21: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

21 © 2020 All rights reserved.

Loading Data - YugabyteDB was 3x faster

Page 22: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

22 © 2020 All rights reserved.

CockroachDB throughput drops over time

Page 23: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

23 © 2020 All rights reserved.

YugabyteDB throughput

Page 24: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

24 © 2020 All rights reserved.

● Reuses PostgreSQL codebase

● RocksDB enhanced

● C/C++ for higher perf

● Sustains high write throughput

● Newly written SQL layer

● RocksDB blackbox

● Go/C++ (inter-language switch)

● Write throughput drops over time

Page 25: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

25 © 2020 All rights reserved.

Page 26: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

26 © 2020 All rights reserved.

Page 27: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

27 © 2020 All rights reserved.

● Reuses PostgreSQL codebase

● Sustains high write throughput

● Higher throughput, lower latency

○ RocksDB enhanced

○ C/C++ for higher perf

● Newly written SQL layer

● Write throughput drops over time

● Lower performance

○ RocksDB blackbox

○ Go/C++ (inter-language switch)

Page 28: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

28 © 2020 All rights reserved.

Performance with larger datasets

How does perf of each DB get affected when going from a small dataset to large dataset (450M rows)?

Page 29: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

29 © 2020 All rights reserved.

Page 30: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

30 © 2020 All rights reserved.

Page 31: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

31 © 2020 All rights reserved.

● Reuses PostgreSQL codebase

● Sustains high write throughput

● Higher throughput, lower latency

○ RocksDB enhanced

○ C/C++ for higher perf

● Large datasets: 9% lower throughput,

11% more latency

● Newly written SQL layer

● Write throughput drops over time

● Lower performance

○ RocksDB blackbox

○ Go/C++ (inter-language switch)

● Large datasets: 51% lower throughput,

180% more latency

Page 32: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

32© 2020 All rights reserved.

Architectural takeawaysObservations loading 1B rows

Page 33: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

33 © 2020 All rights reserved.

Loading 1B rows through YCSB3TB total dataset (1TB per node)

● YugabyteDB completed loading successfully in 26 hrs

● CockroachDB failed to load in reasonable time

● Throughput kept dropping over time

Page 34: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

34 © 2020 All rights reserved.

Next step - investigate why CockroachDB was not able to load 1B rows

Page 35: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

35 © 2020 All rights reserved.

Issue #1: CRDB unevenly uses multiple disks

Two disks supplied, only one disk was utilized.Because CRDB shards (ranges) reuse same RocksDB

Page 36: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

36 © 2020 All rights reserved.

YugabyteDB can leverage multiple disks

Two disks supplied, both are utilized.Each YugabyteDB shard (tablet) uses separate RocksDB

Page 37: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

37 © 2020 All rights reserved.

● Reuses PostgreSQL codebase

● Sustains high write throughput

● Higher throughput, lower latency

○ RocksDB enhanced

○ C/C++ for higher perf

● Large datasets: 9% lower throughput,

11% more latency

● Leverage multiple disks

● Newly written SQL layer

● Write throughput drops over time

● Lower performance

○ RocksDB blackbox

○ Go/C++ (inter-language switch)

● Large datasets: 51% lower throughput,

180% more latency

● Leverage 1 disk (maybe per table?)

Page 38: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

38 © 2020 All rights reserved.

Issue #2: Compactions affect CRDB perf

Right after loading data, query performance was poor.

Observed: 8.5K reads/sec6 hours later: 40K reads/sec

Page 39: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

39 © 2020 All rights reserved.

Read amplification increases with SSTables

More read amplification = DB needs to consult more files.

Page 40: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

40 © 2020 All rights reserved.

Solution: wait for many hours

Page 41: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

41 © 2020 All rights reserved.

YugabyteDB perf high right after compaction

Performance right after loading 1B rows

Page 42: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

42 © 2020 All rights reserved.

● Reuses PostgreSQL codebase

● Sustains high write throughput

● Higher throughput, lower latency

○ RocksDB enhanced

○ C/C++ for higher perf

● Large datasets: 9% lower throughput,

11% more latency

● Leverage multiple disks

● Compactions tuned for perf

● Newly written SQL layer

● Write throughput drops over time

● Lower performance

○ RocksDB blackbox

○ Go/C++ (inter-language switch)

● Large datasets: 51% lower throughput,

180% more latency

● Leverage 1 disk (maybe per table?)

● Compactions policy impacts perf

Page 43: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

43 © 2020 All rights reserved.

Issue #3: Backpressure writes

● Disk could become bottleneck● DB can no longer keep up with writes● Backpressure client to rate limit● Happens often in the real world

Loading data in a node with 2 x 5TB EBS gp2 SSDs

CockroachDB goes into a mode where reads are severely penalized

Page 44: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

44 © 2020 All rights reserved.

Page 45: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

45 © 2020 All rights reserved.

● Reuses PostgreSQL codebase

● Sustains high write throughput

● Higher performance

○ RocksDB enhanced

○ C/C++ for higher perf

● Large datasets: 9% lower throughput,

11% more latency

● Leverage multiple disks

● Compactions tuned for perf

● Backpressure when overloaded

● Newly written SQL layer

● Write throughput drops over time

● Lower performance

○ RocksDB blackbox

○ Go/C++ (inter-language switch)

● Large datasets: 51% lower throughput,

180% more latency

● Leverage 1 disk (maybe per table?)

● Compactions could affect perf

● No backpressure

Page 46: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

46© 2020 All rights reserved.

Licensing Model

Page 47: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

47 © 2020 All rights reserved.

Page 48: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

48 © 2020 All rights reserved.

Don’t fall for fake open source marketing

❌❌

PROPRIETARYFREEMIUM SOFTWARE

Page 49: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

49© 2020 All rights reserved.

Thank You!

We 💛 stars! Give us onegithub.com/yugabyte/yugabyte-db

Join our community yugabyte.com/slack

Page 50: Evaluating CockroachDB vs YugabyteDB€¦ · Evaluating CockroachDB vs YugabyteDB PostgreSQL features, architecture, benchmarks Karthik Ranganathan, Co-founder/CTO, Yugabyte. ...

50© 2020 All rights reserved.

Thanks!


Recommended