18
Methods of benchmarking NoSQL database systems Ilya Bakulin [email protected], [email protected] SMS Traffic LVEE 2011 Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 1 / 16

Methods of NoSQL database systems benchmarking

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Methods of NoSQL database systems benchmarking

Methods of benchmarking NoSQL database systems

Ilya [email protected], [email protected]

SMS Traffic

LVEE 2011

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 1 / 16

Page 2: Methods of NoSQL database systems benchmarking

1 Introduction

2 YCSB benchmarking framework

3 YCSB practical usage

4 Results

5 Where to find further information

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 2 / 16

Page 3: Methods of NoSQL database systems benchmarking

Why benchmarking NoSQL is nessesary

No guides / FAQs about performance are generally available, or areoutdated

NoSQL systems are actively developed

Nobody wants to end up with crashed DB in production right before2-week vacation

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 3 / 16

Page 4: Methods of NoSQL database systems benchmarking

Why benchmarking NoSQL is complex

RDBMS use SQL to provide access to data stored in them, whileNOSQL systems don’t

Each NoSQL uses different protocol (Thrift, Memcached-style, ownprotocols)

Existing benchmarks require SQL to work with database underinspection.

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 4 / 16

Page 5: Methods of NoSQL database systems benchmarking

What is YCSB?

YCSB stands for Yahoo Cloud Serving Benchmark

Developed by Yahoo! Research group

Open Source project, hosted on GitHub (178 watchers, 42 forks)

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 5 / 16

Page 6: Methods of NoSQL database systems benchmarking

Architecture

Java application

Shipped with ready-to-use adapters for several popular Opensourcedatabases

5

Benchmark tool

•! Java application

–! Many systems have Java APIs

–! Other systems via HTTP/REST, JNI or some other solution

Workload parameter file

•! R/W mix •! Record size

•! Data set •! …

Command-line parameters •! DB to use

•! Target throughput •! Number of threads

•! …

YCSB client

DB

clie

nt

Client threads

Stats

Workload executor C

loud D

B

Extensible: plug in new clients Extensible: define new workloads

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 6 / 16

Page 7: Methods of NoSQL database systems benchmarking

More on DB interface

Simple operations: INSERT, UPDATE, REPLACE, DELETE, SCAN

Does not use SQL

... but SQL support is avaible through contributed JDBC driver

... Even sharding configurations are possible

5

Benchmark tool

•! Java application

–! Many systems have Java APIs

–! Other systems via HTTP/REST, JNI or some other solution

Workload parameter file

•! R/W mix •! Record size

•! Data set •! …

Command-line parameters •! DB to use

•! Target throughput •! Number of threads

•! …

YCSB client

DB

clie

nt

Client threads

Stats

Workload executor C

loud D

B

Extensible: plug in new clients Extensible: define new workloads

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 7 / 16

Page 8: Methods of NoSQL database systems benchmarking

More on DB interface

Simple operations: INSERT, UPDATE, REPLACE, DELETE, SCAN

Does not use SQL

... but SQL support is avaible through contributed JDBC driver

... Even sharding configurations are possible

5

Benchmark tool

•! Java application

–! Many systems have Java APIs

–! Other systems via HTTP/REST, JNI or some other solution

Workload parameter file

•! R/W mix •! Record size

•! Data set •! …

Command-line parameters •! DB to use

•! Target throughput •! Number of threads

•! …

YCSB client

DB

clie

nt

Client threads

Stats

Workload executor C

loud D

B

Extensible: plug in new clients Extensible: define new workloads

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 7 / 16

Page 9: Methods of NoSQL database systems benchmarking

More on DB interface

Simple operations: INSERT, UPDATE, REPLACE, DELETE, SCAN

Does not use SQL

... but SQL support is avaible through contributed JDBC driver

... Even sharding configurations are possible

5

Benchmark tool

•! Java application

–! Many systems have Java APIs

–! Other systems via HTTP/REST, JNI or some other solution

Workload parameter file

•! R/W mix •! Record size

•! Data set •! …

Command-line parameters •! DB to use

•! Target throughput •! Number of threads

•! …

YCSB client

DB

clie

nt

Client threads

Stats

Workload executor C

loud D

B

Extensible: plug in new clients Extensible: define new workloads

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 7 / 16

Page 10: Methods of NoSQL database systems benchmarking

More on workload

Specifies what DBoperations are used byapplication

Also defines requestdistribution

It is possible to specifyrecord size

It’s possible to specifynumber of records andoperations

• Update: Update a record by replacing the value of onefield.

• Read: Read a record, either one randomly chosen fieldor all fields.

• Scan: Scan records in order, starting at a randomlychosen record key. The number of records to scan israndomly chosen.

For scan specifically, the distribution of scan lengths ischosen as part of the workload. Thus, the scan() methodtakes an initial key and the number of records to scan. Ofcourse, a real application may instead specify a scan interval(i.e., from February 1st to February 15th). The number ofrecords parameter allows us to control the size of these in-tervals, without having to determine and specify meaningfulendpoints for the scan. (All of the database calls, includingscan(), are described in Section 5.2.1.)

4.1 DistributionsThe workload client must make many random choices

when generating load: which operation to perform (Insert,Update, Read or Scan), which record to read or write, howmany records to scan, and so on. These decisions are gov-erned by random distributions. YCSB has several built-indistributions:

• Uniform: Choose an item uniformly at random. For ex-ample, when choosing a record, all records in the databaseare equally likely to be chosen.

• Zipfian: Choose an item according to the Zipfian dis-tribution. For example, when choosing a record, somerecords will be extremely popular (the head of the distri-bution) while most records will be unpopular (the tail).

• Latest: Like the Zipfian distribution, except that themost recently inserted records are in the head of the dis-tribution.

• Multinomial: Probabilities for each item can be speci-fied. For example, we might assign a probability of 0.95to the Read operation, a probability of 0.05 to the Up-date operation, and a probability of 0 to Scan and Insert.The result would be a read-heavy workload.

Figure 1 illustrates the di!erence between the uniform,zipfian and latest distributions. The horizontal axes in thefigure represent the items that may be chosen (e.g., records)in order of insertion, while the vertical bars represent theprobability that the item is chosen. Note that the last in-serted item may not be inserted at the end of the key space.For example, Twitter status updates might be clustered byuser, rather than by timestamp, meaning that two recentlyinserted items may be far apart in the key space.

A key di!erence between the Latest and Zipfian distribu-tions is their behavior when new items are inserted. Underthe Latest distribution, the newly inserted item becomes themost popular, while the previously popular items becomeless so. Under the Zipfian distribution, items retain theirpopularity even as new items are inserted, whether or notthe newly inserted item is popular. The Latest distributionis meant to model applications where recency matters; forexample, only recent blog posts or news stories are popular,and the popularity decays quickly. In contrast, the Zipfiandistribution models items whose popularity is independentof their newness; a particular user might be extremely pop-

Uniform:

!"#$%&'(")(%*$%

+(,-./%'&0

1)))2)))333 4

Zipfian:

!"#$%&'(")(%*$%

+(,-./%'&0

1)))2)))333 4

Latest:

!"#$%&'(")(%*$%

+(,-./%'&0

1)))2)))333 4

Figure 1: Probability distributions. Horizontal axesrepresents items in order of insertion, and verticalaxes represent probability of being chosen.

ular, with many views of her profile page, even though shehas joined many years ago.

4.2 The WorkloadsWe defined the workloads in the core package by assign-

ing di!erent distributions to the two main choices we mustmake: which operation to perform, and which record to reador write. The various combinations are shown in Table 2.Although we do not attempt to model complex applicationsprecisely (as discussed above), we list a sample applicationthat generally has the characteristics of the workload.

Loading the database is likely to take longer than anyindividual experiment. In our tests, loads took between 10-20 hours (depending on the database system), while we raneach experiment (e.g., a particular workload at a particulartarget throughput against a particular database) for 30 min-utes. All the core package workloads use the same dataset,so it is possible to load the database once and then run allthe workloads. However, workloads A and B modify records,and D and E insert records. If database writes are likely toimpact the operation of other workloads (e.g., by fragment-ing the on-disk representation) it may be necessary to re-loadthe database. We do not prescribe a particular databaseloading strategy in our benchmark, since di!erent databasesystems have di!erent loading mechanisms (including somethat have no special bulk load facility at all).

5. DETAILS OF THE BENCHMARK TOOLWe have developed a tool, called the YCSB Client, to

execute the YCSB benchmarks. A key design goal of ourtool is extensibility, so that it can be used to benchmarknew cloud database systems, and so that new workloadscan be developed. We have used this tool to measure theperformance of several cloud systems, as we report in thenext section. This tool is also available under an open sourcelicense, so that others may use and extend the tool, andcontribute new workloads and database interfaces.

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 8 / 16

Page 11: Methods of NoSQL database systems benchmarking

/* TODO: Remove this crap */

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 9 / 16

Page 12: Methods of NoSQL database systems benchmarking

SMS Traffic: workload construction

SMS service provider, several gateways, big clients (such as banks)

15% inserts, 65% updates, 15% reads

Request distribution: latest SMS messages are the ”hottest” ones

Evaluated Cassandra and sharded MySQL as DB storage for the nextgeneration of SMS sending platform

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 10 / 16

Page 13: Methods of NoSQL database systems benchmarking

Testing process

3 instances of DBMS system on one server (Core Quad Q9400, 4GBRAM, SATA-II HDD, FreeBSD 8.2-amd64)

Cassandra 0.7.4 (1GB Java heap / instance)

MySQL 5.1 + InnoDB engine (1GB InnoDB buffer pool size /instance)

Client: separate machine, 1Gb/s connection

Should avoid swapping and disk IO saturation

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 11 / 16

Page 14: Methods of NoSQL database systems benchmarking

Some resuts: Workload ”A”: 50% read / 50% write

9

Workload A – Update heavy •! 50/50 Read/update

Comment: Cassandra is optimized for writes, and achieves higher throughput and lower latency. Sherpa and MySQL achieve roughly comparable performance, as both are limited by MySQL’s capabilities. HBase has good write latency, because of commits to memory, and somewhat higher read latency, because of the need to reconstruct records.

0

10

20

30

40

50

60

70

0 5000 10000 15000

Avera

ge r

ead late

ncy (

ms)

Throughput (ops/sec)

Workload A - Read latency

Cassandra Hbase Sherpa MySQL

0

10

20

30

40

50

60

70

80

0 5000 10000 15000

Update

late

ncy (

ms)

Throughput (ops/sec)

Workload A - Update latency

Cassandra Hbase Sherpa MySQL

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 12 / 16

Page 15: Methods of NoSQL database systems benchmarking

Some resuts: Workload ”A”: 50% read / 50% write

9

Workload A – Update heavy •! 50/50 Read/update

Comment: Cassandra is optimized for writes, and achieves higher throughput and lower latency. Sherpa and MySQL achieve roughly comparable performance, as both are limited by MySQL’s capabilities. HBase has good write latency, because of commits to memory, and somewhat higher read latency, because of the need to reconstruct records.

0

10

20

30

40

50

60

70

0 5000 10000 15000

Avera

ge r

ead late

ncy (

ms)

Throughput (ops/sec)

Workload A - Read latency

Cassandra Hbase Sherpa MySQL

0

10

20

30

40

50

60

70

80

0 5000 10000 15000

Update

late

ncy (

ms)

Throughput (ops/sec)

Workload A - Update latency

Cassandra Hbase Sherpa MySQL

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 13 / 16

Page 16: Methods of NoSQL database systems benchmarking

Some resuts: Workload ”B”: 95% read / 5% write

10

•! 95/5 Read/update

Comment: Sherpa does very well here, with better read latency – only one lookup into a B-tree is needed for reads, unlike log-structured systems where records must be reconstructed. Cassandra also performs well, matching Sherpa until high throughputs. HBase does well also, although read time is higher.

Workload B – Read heavy

0

2

4

6

8

10

12

14

16

18

20

0 2000 4000 6000 8000 10000

Avera

ge r

ead late

ncy (

ms)

Throughput (operations/sec)

Workload B - Read latency

Cassandra HBase Sherpa MySQL

0

5

10

15

20

25

30

35

40

0 2000 4000 6000 8000 10000

Avera

ge u

pdate

late

ncy (

ms)

Throughput (operations/sec)

Workload B - Update latency

Cassandra Hbase Sherpa MySQL

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 14 / 16

Page 17: Methods of NoSQL database systems benchmarking

Some resuts: Workload ”B”: 95% read / 5% write

10

•! 95/5 Read/update

Comment: Sherpa does very well here, with better read latency – only one lookup into a B-tree is needed for reads, unlike log-structured systems where records must be reconstructed. Cassandra also performs well, matching Sherpa until high throughputs. HBase does well also, although read time is higher.

Workload B – Read heavy

0

2

4

6

8

10

12

14

16

18

20

0 2000 4000 6000 8000 10000

Avera

ge r

ead late

ncy (

ms)

Throughput (operations/sec)

Workload B - Read latency

Cassandra HBase Sherpa MySQL

0

5

10

15

20

25

30

35

40

0 2000 4000 6000 8000 10000

Avera

ge u

pdate

late

ncy (

ms)

Throughput (operations/sec)

Workload B - Update latency

Cassandra Hbase Sherpa MySQL

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 15 / 16

Page 18: Methods of NoSQL database systems benchmarking

Links

Yahoo Cloud Serving Benchmark:https://github.com/brianfrankcooper/YCSB

google://

[email protected], [email protected]

Ilya Bakulin (SMS Traffic) NoSQL benchmarking July 2, 2011 16 / 16