├── .directory ├── .gitignore ├── .travis.yml ├── BUILD ├── LICENSE.txt ├── NOTICE.txt ├── README.md ├── _config.yml ├── adding_a_database.md ├── akumuli ├── akumuli-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ ├── AkumuliClient.java │ └── Test.java ├── atsd ├── atsd-binding.iml ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── yahoo │ │ └── ycsb │ │ └── db │ │ └── ATSDClient.java │ └── resources │ └── logback.xml ├── bin └── ycsb ├── binding-parent ├── binding-parent.iml ├── datastore-specific-descriptor │ ├── datastore-specific-descriptor.iml │ ├── pom.xml │ └── src │ │ └── main │ │ └── resources │ │ └── assemblies │ │ └── datastore-specific-assembly.xml └── pom.xml ├── blueflood ├── blueflood-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── BluefloodClient.java ├── checkstyle.xml ├── core ├── CHANGES.md ├── core.iml ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── yahoo │ │ └── ycsb │ │ ├── BasicDB.java │ │ ├── ByteArrayByteIterator.java │ │ ├── ByteIterator.java │ │ ├── Client.java │ │ ├── CommandLine.java │ │ ├── DB.java │ │ ├── DBException.java │ │ ├── DBFactory.java │ │ ├── DBWrapper.java │ │ ├── GoodBadUglyDB.java │ │ ├── InputStreamByteIterator.java │ │ ├── RandomByteIterator.java │ │ ├── StringByteIterator.java │ │ ├── TerminatorThread.java │ │ ├── ThreadedCSVReader.java │ │ ├── UnknownDBException.java │ │ ├── Utils.java │ │ ├── Workload.java │ │ ├── WorkloadException.java │ │ ├── generator │ │ ├── AcknowledgedCounterGenerator.java │ │ ├── ConstantLongGenerator.java │ │ ├── CounterGenerator.java │ │ ├── DiscreteGenerator.java │ │ ├── ExponentialGenerator.java │ │ ├── FileGenerator.java │ │ ├── Generator.java │ │ ├── HistogramGenerator.java │ │ ├── HotspotLongGenerator.java │ │ ├── IntegerGenerator.java │ │ ├── LongGenerator.java │ │ ├── ScrambledZipfianGenerator.java │ │ ├── SkewedLatestGenerator.java │ │ ├── UniformGenerator.java │ │ ├── UniformLongGenerator.java │ │ └── ZipfianGenerator.java │ │ ├── measurements │ │ ├── Measurements.java │ │ ├── OneMeasurement.java │ │ ├── OneMeasurementHdrHistogram.java │ │ ├── OneMeasurementHistogram.java │ │ ├── OneMeasurementTimeSeries.java │ │ ├── TwoInOneMeasurement.java │ │ └── exporter │ │ │ ├── JSONArrayMeasurementsExporter.java │ │ │ ├── JSONMeasurementsExporter.java │ │ │ ├── MeasurementsExporter.java │ │ │ └── TextMeasurementsExporter.java │ │ └── workloads │ │ ├── ConstantOccupancyWorkload.java │ │ └── CoreWorkload.java │ └── test │ └── java │ └── com │ └── yahoo │ └── ycsb │ ├── TestByteIterator.java │ ├── generator │ ├── AcknowledgedCounterGeneratorTest.java │ └── TestZipfianGenerator.java │ └── measurements │ └── exporter │ └── TestMeasurementsExporter.java ├── databus ├── databus-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ ├── DatabusClient.java │ └── Test.java ├── distribution ├── pom.xml ├── src │ └── main │ │ └── assembly │ │ └── distribution.xml └── ycsb.iml ├── druid ├── druid-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── DruidClient.java ├── elasticsearch ├── elasticsearch-binding.iml ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── yahoo │ │ └── ycsb │ │ └── db │ │ ├── ElasticsearchClient.java │ │ └── Test.java │ └── resources │ └── template.json ├── gnocchi ├── gnocchi-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── GnocchiClient.java ├── graphite ├── graphite-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ ├── GraphiteClient.java │ └── Test.java ├── h5serv ├── h5serv-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ ├── H5ServClient.java │ └── HttpGetWithEntity.java ├── hana ├── hana-binding.iml ├── pom.xml └── src │ └── main │ ├── conf │ └── hana.properties │ ├── java │ └── com │ │ └── yahoo │ │ └── ycsb │ │ └── db │ │ ├── JdbcDBCli.java │ │ ├── JdbcDBClient.java │ │ ├── JdbcDBClientConstants.java │ │ └── JdbcDBCreateTable.java │ └── resources │ └── sql │ ├── README │ ├── create_table.monetdb │ ├── create_table.mysql │ ├── create_table.psql │ └── create_table.sql ├── influxdb-java ├── CHANGELOG.md ├── Dockerfile ├── LICENSE ├── influxdb-java.iml ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── influxdb │ ├── InfluxDB.java │ ├── InfluxDBFactory.java │ ├── dto │ ├── BatchPoints.java │ ├── Point.java │ ├── Pong.java │ ├── Query.java │ └── QueryResult.java │ └── impl │ ├── BatchProcessor.java │ ├── InfluxDBErrorHandler.java │ ├── InfluxDBImpl.java │ ├── InfluxDBService.java │ └── TimeUtil.java ├── influxdb ├── influxdb-binding.iml ├── influxdb.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── InfluxDBClient.java ├── jdbc ├── jdbc-binding.iml ├── pom.xml └── src │ └── main │ ├── conf │ ├── db.properties │ └── h2.properties │ ├── java │ └── com │ │ └── yahoo │ │ └── ycsb │ │ └── db │ │ ├── JdbcDBCli.java │ │ ├── JdbcDBClient.java │ │ ├── JdbcDBClientConstants.java │ │ └── JdbcDBCreateTable.java │ └── resources │ └── sql │ ├── README │ ├── create_table.monetdb │ ├── create_table.mysql │ ├── create_table.psql │ └── create_table.sql ├── kairosdb ├── kairosdb-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ ├── .directory │ └── ycsb │ └── db │ └── KairosDBClient.java ├── kdbplus-java ├── kdbplus-java.iml ├── pom.xml └── src │ └── main │ └── java │ └── kx │ └── c.java ├── kdbplus ├── kdbplus-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── KdbPlusClient.java ├── newts ├── newts-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── NewTSClient.java ├── opentsdb ├── opentsdb-binding.iml ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── OpenTSDBClient.java ├── pom.xml ├── prometheus ├── pom.xml ├── prometheus-binding.iml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── PrometheusClient.java ├── rhombus ├── pom.xml ├── rhombus-binding.iml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ └── RhombusClient.java ├── root.iml ├── seriesly ├── pom.xml ├── seriesly-binding.iml └── src │ └── main │ └── java │ └── com │ └── yahoo │ └── ycsb │ └── db │ ├── SerieslyClient.java │ └── Test.java └── workloads ├── testworkloada ├── testworkloadb ├── workload_template ├── workloada └── workloadb /.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | PreviewsShown=true 3 | Timestamp=2015,11,10,22,3,24 4 | Version=3 5 | ViewMode=1 6 | 7 | [Settings] 8 | HiddenFilesShown=true 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Git ignore File 2 | 3 | **/*.pyc 4 | **/__pycache__ 5 | .* 6 | !/.gitignore 7 | 8 | **/*.directory 9 | */data.csv 10 | *.log 11 | *.ydc 12 | *.html 13 | *.pdf 14 | *.tar.gz 15 | **/target/* 16 | .idea/* 17 | # *.iml 18 | .project 19 | .classpath 20 | .settings 21 | .checkstyle 22 | .DS_Store 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 Yahoo! Inc., 2012 - 2015 YCSB contributors. 2 | # All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you 5 | # may not use this file except in compliance with the License. You 6 | # may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | # implied. See the License for the specific language governing 14 | # permissions and limitations under the License. See accompanying 15 | # LICENSE file. 16 | 17 | # more info here about TravisCI and Java projects 18 | # http://docs.travis-ci.com/user/languages/java/ 19 | 20 | language: java 21 | 22 | jdk: 23 | - oraclejdk8 24 | - openjdk8 25 | 26 | install: mvn install -q -DskipTests=true 27 | 28 | script: mvn test -q 29 | 30 | # Use the Container based infrastructure. 31 | sudo: false 32 | -------------------------------------------------------------------------------- /BUILD: -------------------------------------------------------------------------------- 1 | # Building YCSB 2 | 3 | To build YCSB, run: 4 | 5 | mvn clean package 6 | 7 | # Running YCSB 8 | 9 | Once `mvn clean package` succeeds, you can run `ycsb` command: 10 | 11 | ./bin/ycsb load basic workloads/workloada 12 | ./bin/ycsb run basic workloads/workloada 13 | 14 | # Oracle NoSQL Database 15 | 16 | Oracle NoSQL Database binding doesn't get built by default because there is no 17 | Maven repository for it. To build the binding: 18 | 19 | 1. Download kv-ce-1.2.123.tar.gz from here: 20 | 21 | http://www.oracle.com/technetwork/database/nosqldb/downloads/index.html 22 | 23 | 2. Untar kv-ce-1.2.123.tar.gz and install kvclient-1.2.123.jar in your local 24 | maven repository: 25 | 26 | tar xfvz kv-ce-1.2.123.tar.gz 27 | mvn install:install-file -Dfile=kv-1.2.123/lib/kvclient-1.2.123.jar \ 28 | -DgroupId=com.oracle -DartifactId=kvclient -Dversion=1.2.123 29 | -Dpackaging=jar 30 | 31 | 3. Uncomment `nosqldb` and run `mvn clean package`. 32 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | NOTICE file for use with, and corresponding to Section 4 of, 3 | the Apache License, Version 2.0, 4 | in this case for the YCSB-TS project. 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | the YCSB contributors (https://github.com/brianfrankcooper/YCSB/graphs/contributors) 9 | Copyright (c) 2015 YCSB contributors All rights reserved. 10 | 11 | This product includes software developed by 12 | Yahoo! Inc. (www.yahoo.com) 13 | Copyright (c) 2010 Yahoo! Inc. All rights reserved. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YCSB-TS 2 | [![Build Status](https://travis-ci.org/TSDBBench/YCSB-TS.svg?branch=master)](https://travis-ci.org/TSDBBench/YCSB-TS) 3 | 4 | YCSB-TS is a fork of [YCSB](http://github.com/brianfrankcooper/YCSB) that is adopted to use basic time domain functions and support timestamps and timeranges. 5 | It is used in [TSDBBench](https://tsdbbench.github.io/) to measure the performance of time series databases (TSDBs). 6 | To achieve this, many new workload options are introduced, as well as bindings for many TSDBs. 7 | 8 | The benchmark is usually executed using [Overlord](https://github.com/TSDBBench/Overlord). 9 | 10 | Supported databases are tracked at . 11 | 12 | ## Getting Started 13 | 14 | * To build the full distribution, with all database bindings: 15 | `mvn clean package` 16 | * The usage is the same as original YCSB, see the documentation [here](http://github.com/brianfrankcooper/YCSB). 17 | * new workload options are documented in [workload_template](workloads/workload_template) and [CoreWorkload.java](core/src/main/java/com/yahoo/ycsb/workloads/CoreWorkload.java) 18 | 19 | ## Additional Information 20 | 21 | * Everything was tested and used on Debian Jessie x64, but should work on Ubuntu. 22 | * Ubuntu has different package names for a lot of the packages, you need to find and change them 23 | * Logfiles/Benchmark Results are stored compressed as .ydc Files 24 | 25 | ## Development Information 26 | 27 | * See the [README.md of Overlord](https://github.com/TSDBBench/Overlord) for more information 28 | * The original tests are untouched and therefore not working and should be fixed 29 | * [Adding a New Database](adding_a_database.md) 30 | 31 | ## Funding 32 | 33 | TSDBBench received funding from the 34 | [Federal Ministry for Economic Affairs and Energy](http://www.bmwi.de/Navigation/EN/Home/home.html) 35 | in the context of the project [NEMAR](https://www.nemar.de/). 36 | 37 | ![BMWi](https://tsdbbench.github.io/BMWi.jpg) 38 | 39 | ## Related Links 40 | 41 | * [YCSB on Github](http://github.com/brianfrankcooper/YCSB) 42 | * [YCSB Wiki on Github](http://wiki.github.com/brianfrankcooper/YCSB) 43 | * [Overlord](https://github.com/TSDBBench/Overlord) 44 | * [Comparison of TSDBs (Andreas Bader)](http://www2.informatik.uni-stuttgart.de/cgi-bin/NCSTRL/NCSTRL_view.pl?id=DIP-3729&mod=0&engl=0&inst=FAK) 45 | * [Survey and Comparison of Open Source TSDBs (Andreas Bader, Oliver Kopp, Michael Falkenthal)](http://www2.informatik.uni-stuttgart.de/cgi-bin/NCSTRL/NCSTRL_view.pl?id=INPROC-2017-06&mod=0&engl=0&inst=IPVS) 46 | * [Ultimate Comparison of TSDBs](https://tsdbbench.github.io/Ultimate-TSDB-Comparison/) 47 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | remote_theme: adr/slate 2 | anchor: true 3 | -------------------------------------------------------------------------------- /akumuli/akumuli-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /akumuli/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.yahoo.ycsb 6 | binding-parent 7 | 0.4.0 8 | ../binding-parent 9 | 10 | 11 | akumuli-binding 12 | Akumuli Binding 13 | 14 | 15 | 16 | com.yahoo.ycsb 17 | core 18 | ${project.version} 19 | provided 20 | 21 | 22 | org.apache.httpcomponents 23 | httpclient 24 | 4.5.2 25 | 26 | 27 | org.json 28 | json 29 | 20151123 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /akumuli/src/main/java/com/yahoo/ycsb/db/Test.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.ycsb.db; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.ArrayList; 5 | import java.util.HashMap; 6 | //import java.time.Instant; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | import com.yahoo.ycsb.ByteIterator; 10 | import com.yahoo.ycsb.DBException; 11 | import com.yahoo.ycsb.StringByteIterator; 12 | 13 | public class Test { 14 | 15 | public static void main(String[] args) throws DBException { 16 | 17 | AkumuliClient client = new AkumuliClient(); 18 | client.init(); 19 | 20 | HashMap tagsInsert = new HashMap(); 21 | tagsInsert.put("tag1_Key", new StringByteIterator("tag1_Val1")); 22 | HashMap tagsInsert2 = new HashMap(); 23 | tagsInsert2.put("tag1_Key", new StringByteIterator("tag1_Val2")); 24 | 25 | // Insert tests 26 | System.out.println(client.insert("metric1", Timestamp.valueOf("2001-10-19 20:15:00"), 1.0, tagsInsert)); 27 | System.out.println(client.insert("metric1", Timestamp.valueOf("2001-10-19 20:15:00"), 1.5, tagsInsert2)); 28 | System.out.println(client.insert("metric1", Timestamp.valueOf("2013-01-20 00:00:00"), 2.0, tagsInsert)); 29 | System.out.println(client.insert("metric2", Timestamp.valueOf("2016-04-03 19:56:00"), 3.0, tagsInsert)); 30 | 31 | System.out.println(client.insert("metric2", Timestamp.valueOf("2016-04-04 09:30:00"), 1.5, tagsInsert2)); 32 | System.out.println(client.insert("metric2", Timestamp.valueOf("2016-04-04 09:40:00"), 2.5, tagsInsert2)); 33 | System.out.println(client.insert("metric2", Timestamp.valueOf("2016-04-04 09:50:00"), 3.5, tagsInsert2)); 34 | System.out.println(client.insert("metric2", Timestamp.valueOf("2016-04-04 09:55:00"), 4.5, tagsInsert2)); 35 | 36 | 37 | 38 | HashMap> tagsQuery = new HashMap>(); 39 | ArrayList tagValues = new ArrayList(); 40 | tagValues.add("tag1_Val1"); 41 | tagValues.add("tag1_Val2"); 42 | tagsQuery.put("tag1_Key", tagValues); 43 | 44 | // Read tests 45 | System.out.println(client.read("metric1", Timestamp.valueOf("2001-10-19 20:15:00"), tagsQuery)); 46 | System.out.println(client.read("metric2", Timestamp.valueOf("2016-04-03 19:56:00"), tagsQuery)); 47 | 48 | // Scan tests 49 | client.scan("metric2", Timestamp.valueOf("2016-04-04 09:30:00"), 50 | Timestamp.valueOf("2016-04-04 10:00:00"), tagsQuery, true, false, false, 15, TimeUnit.MINUTES); 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /atsd/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.yahoo.ycsb 5 | binding-parent 6 | 0.4.0 7 | ../binding-parent 8 | 9 | atsd-binding 10 | 11 | 12 | com.yahoo.ycsb 13 | core 14 | ${project.version} 15 | provided 16 | 17 | 18 | com.axibase 19 | atsd-api-java 20 | 1.0.0 21 | 22 | 23 | ATSD Binding 24 | 25 | -------------------------------------------------------------------------------- /atsd/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /binding-parent/binding-parent.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /binding-parent/datastore-specific-descriptor/datastore-specific-descriptor.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /binding-parent/datastore-specific-descriptor/pom.xml: -------------------------------------------------------------------------------- 1 | 17 | 19 | 4.0.0 20 | 21 | 22 | com.yahoo.ycsb 23 | root 24 | 0.4.0 25 | ../../ 26 | 27 | 28 | datastore-specific-descriptor 29 | Per Datastore Binding descriptor 30 | jar 31 | 32 | 33 | This module contains the assembly descriptor used by the individual components 34 | to build binding-specific distributions. 35 | 36 | 37 | 38 | com.yahoo.ycsb 39 | core 40 | ${project.version} 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /binding-parent/datastore-specific-descriptor/src/main/resources/assemblies/datastore-specific-assembly.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 21 | dist 22 | true 23 | ycsb-${artifactId}-${version} 24 | 25 | 26 | README.md 27 | 28 | 29 | 30 | 31 | 32 | .. 33 | 34 | 0644 35 | 36 | LICENSE.txt 37 | NOTICE.txt 38 | 39 | 40 | 41 | ../bin 42 | bin 43 | 0755 44 | 45 | ycsb 46 | 47 | 48 | 49 | ../workloads 50 | workloads 51 | 0644 52 | 53 | 54 | src/main/conf 55 | conf 56 | 0644 57 | 58 | 59 | 60 | 61 | lib 62 | 63 | com.yahoo.ycsb:core 64 | 65 | provided 66 | true 67 | 68 | 69 | lib 70 | 71 | *:jar:* 72 | 73 | 74 | *:sources 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /blueflood/blueflood-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /blueflood/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | blueflood-binding 13 | Blueflood Binding 14 | jar 15 | 16 | 17 | 18 | org.json 19 | json 20 | 20140107 21 | 22 | 23 | org.apache.httpcomponents 24 | httpclient 25 | 4.5 26 | 27 | 28 | com.yahoo.ycsb 29 | core 30 | ${project.version} 31 | provided 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /core/core.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 4.0.0 22 | 23 | com.yahoo.ycsb 24 | root 25 | 0.4.0 26 | 27 | 28 | core 29 | Core YCSB 30 | jar 31 | 32 | 33 | 1.9.4 34 | 35 | 36 | 37 | 38 | org.codehaus.jackson 39 | jackson-mapper-asl 40 | ${jackson.api.version} 41 | 42 | 43 | org.codehaus.jackson 44 | jackson-core-asl 45 | ${jackson.api.version} 46 | 47 | 48 | org.testng 49 | testng 50 | 6.1.1 51 | test 52 | 53 | 54 | org.hdrhistogram 55 | HdrHistogram 56 | 2.1.4 57 | 58 | 59 | net.sourceforge.javacsv 60 | javacsv 61 | 2.0 62 | 63 | 64 | 65 | 66 | 67 | org.apache.maven.plugins 68 | maven-assembly-plugin 69 | ${maven.assembly.version} 70 | 71 | 72 | jar-with-dependencies 73 | 74 | false 75 | 76 | 77 | 78 | package 79 | 80 | single 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/ByteArrayByteIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb; 18 | 19 | public class ByteArrayByteIterator extends ByteIterator { 20 | final int len; 21 | byte[] str; 22 | int off; 23 | 24 | public ByteArrayByteIterator(byte[] s) { 25 | this.str = s; 26 | this.off = 0; 27 | this.len = s.length; 28 | } 29 | 30 | public ByteArrayByteIterator(byte[] s, int off, int len) { 31 | this.str = s; 32 | this.off = off; 33 | this.len = off + len; 34 | } 35 | 36 | @Override 37 | public boolean hasNext() { 38 | return off < len; 39 | } 40 | 41 | @Override 42 | public byte nextByte() { 43 | byte ret = str[off]; 44 | off++; 45 | return ret; 46 | } 47 | 48 | @Override 49 | public long bytesLeft() { 50 | return len - off; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/DBException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb; 19 | 20 | /** 21 | * Something bad happened while interacting with the database. 22 | */ 23 | public class DBException extends Exception { 24 | /** 25 | * 26 | */ 27 | private static final long serialVersionUID = 6646883591588721475L; 28 | 29 | public DBException(String message) { 30 | super(message); 31 | } 32 | 33 | public DBException() { 34 | super(); 35 | } 36 | 37 | public DBException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | public DBException(Throwable cause) { 42 | super(cause); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/DBFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb; 19 | 20 | import java.util.Properties; 21 | 22 | /** 23 | * Creates a DB layer by dynamically classloading the specified DB class. 24 | */ 25 | public class DBFactory { 26 | @SuppressWarnings("unchecked") 27 | public static DB newDB(String dbname, Properties properties) throws UnknownDBException { 28 | ClassLoader classLoader = DBFactory.class.getClassLoader(); 29 | 30 | DB ret = null; 31 | 32 | try { 33 | Class dbclass = classLoader.loadClass(dbname); 34 | //System.out.println("dbclass.getName() = " + dbclass.getName()); 35 | 36 | ret = (DB) dbclass.newInstance(); 37 | } 38 | catch (Exception e) { 39 | e.printStackTrace(); 40 | return null; 41 | } 42 | 43 | ret.setProperties(properties); 44 | 45 | return new DBWrapper(ret); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/InputStreamByteIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb; 18 | 19 | import java.io.InputStream; 20 | 21 | public class InputStreamByteIterator extends ByteIterator { 22 | long len; 23 | InputStream ins; 24 | long off; 25 | 26 | public InputStreamByteIterator(InputStream ins, long len) { 27 | this.len = len; 28 | this.ins = ins; 29 | off = 0; 30 | } 31 | 32 | @Override 33 | public boolean hasNext() { 34 | return off < len; 35 | } 36 | 37 | @Override 38 | public byte nextByte() { 39 | int ret; 40 | try { 41 | ret = ins.read(); 42 | } 43 | catch (Exception e) { 44 | throw new IllegalStateException(e); 45 | } 46 | if (ret == -1) { 47 | throw new IllegalStateException("Past EOF!"); 48 | } 49 | off++; 50 | return (byte) ret; 51 | } 52 | 53 | @Override 54 | public long bytesLeft() { 55 | return len - off; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/RandomByteIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb; 18 | 19 | /** 20 | * A ByteIterator that generates a random sequence of bytes. 21 | */ 22 | public class RandomByteIterator extends ByteIterator { 23 | private long len; 24 | private long off; 25 | private int bufOff; 26 | private byte[] buf; 27 | 28 | public RandomByteIterator(long len) { 29 | this.len = len; 30 | this.buf = new byte[6]; 31 | this.bufOff = buf.length; 32 | fillBytes(); 33 | this.off = 0; 34 | } 35 | 36 | @Override 37 | public boolean hasNext() { 38 | return (off + bufOff) < len; 39 | } 40 | 41 | private void fillBytesImpl(byte[] buffer, int base) { 42 | // we need A-Za-z0-9, which convertes to the range (Ascii/UTF-8): 43 | // 0-9 48-57 44 | // A-Z 65-90 45 | // a-z 97-122 46 | try { 47 | buffer[base + 0] = (byte) this.getRandAN(); 48 | buffer[base + 1] = (byte) this.getRandAN(); 49 | buffer[base + 2] = (byte) this.getRandAN(); 50 | buffer[base + 3] = (byte) this.getRandAN(); 51 | buffer[base + 4] = (byte) this.getRandAN(); 52 | buffer[base + 5] = (byte) this.getRandAN(); 53 | } catch (ArrayIndexOutOfBoundsException e) { /* ignore it */ } 54 | } 55 | 56 | private void fillBytes() { 57 | if (bufOff == buf.length) { 58 | fillBytesImpl(buf, 0); 59 | bufOff = 0; 60 | off += buf.length; 61 | } 62 | } 63 | 64 | public byte nextByte() { 65 | fillBytes(); 66 | bufOff++; 67 | return buf[bufOff - 1]; 68 | } 69 | 70 | @Override 71 | public int nextBuf(byte[] buffer, int bufferOffset) { 72 | int ret; 73 | if (len - off < buffer.length - bufferOffset) { 74 | ret = (int) (len - off); 75 | } else { 76 | ret = buffer.length - bufferOffset; 77 | } 78 | int i; 79 | for (i = 0; i < ret; i += 6) { 80 | fillBytesImpl(buffer, i + bufferOffset); 81 | } 82 | off += ret; 83 | return ret + bufferOffset; 84 | } 85 | 86 | @Override 87 | public long bytesLeft() { 88 | return len - off - bufOff; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/StringByteIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | public class StringByteIterator extends ByteIterator { 24 | String str; 25 | int off; 26 | 27 | public StringByteIterator(String s) { 28 | this.str = s; 29 | this.off = 0; 30 | } 31 | 32 | /** 33 | * Put all of the entries of one map into the other, converting 34 | * String values into ByteIterators. 35 | */ 36 | public static void putAllAsByteIterators(Map out, Map in) { 37 | for (String s : in.keySet()) { 38 | out.put(s, new StringByteIterator(in.get(s))); 39 | } 40 | } 41 | 42 | /** 43 | * Put all of the entries of one map into the other, converting 44 | * ByteIterator values into Strings. 45 | */ 46 | public static void putAllAsStrings(Map out, Map in) { 47 | for (String s : in.keySet()) { 48 | out.put(s, in.get(s).toString()); 49 | } 50 | } 51 | 52 | /** 53 | * Create a copy of a map, converting the values from Strings to 54 | * StringByteIterators. 55 | */ 56 | public static HashMap getByteIteratorMap(Map m) { 57 | HashMap ret = 58 | new HashMap(); 59 | 60 | for (String s : m.keySet()) { 61 | ret.put(s, new StringByteIterator(m.get(s))); 62 | } 63 | return ret; 64 | } 65 | 66 | /** 67 | * Create a copy of a map, converting the values from 68 | * StringByteIterators to Strings. 69 | */ 70 | public static HashMap getStringMap(Map m) { 71 | HashMap ret = new HashMap(); 72 | 73 | for (String s : m.keySet()) { 74 | ret.put(s, m.get(s).toString()); 75 | } 76 | return ret; 77 | } 78 | 79 | @Override 80 | public boolean hasNext() { 81 | return off < str.length(); 82 | } 83 | 84 | @Override 85 | public byte nextByte() { 86 | byte ret = (byte) str.charAt(off); 87 | off++; 88 | return ret; 89 | } 90 | 91 | @Override 92 | public long bytesLeft() { 93 | return str.length() - off; 94 | } 95 | 96 | /** 97 | * Specialization of general purpose toString() to avoid unnecessary 98 | * copies. 99 | *

100 | * Creating a new StringByteIterator, then calling toString() 101 | * yields the original String object, and does not perform any copies 102 | * or String conversion operations. 103 | *

104 | */ 105 | @Override 106 | public String toString() { 107 | if (off > 0) { 108 | return super.toString(); 109 | } 110 | else { 111 | return str; 112 | } 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/TerminatorThread.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb; 18 | 19 | import java.util.List; 20 | import java.util.Vector; 21 | 22 | /** 23 | * A thread that waits for the maximum specified time and then interrupts all the client 24 | * threads passed as the Vector at initialization of this thread. 25 | * 26 | * The maximum execution time passed is assumed to be in seconds. 27 | * 28 | * @author sudipto 29 | * 30 | */ 31 | public class TerminatorThread extends Thread { 32 | 33 | private final List threads; 34 | private long maxExecutionTime; 35 | private Workload workload; 36 | private long waitTimeOutInMS; 37 | 38 | public TerminatorThread(long maxExecutionTime, List threads, 39 | Workload workload) { 40 | this.maxExecutionTime = maxExecutionTime; 41 | this.threads = threads; 42 | this.workload = workload; 43 | waitTimeOutInMS = 2000; 44 | System.err.println("Maximum execution time specified as: " + maxExecutionTime + " secs"); 45 | } 46 | 47 | public void run() { 48 | try { 49 | Thread.sleep(maxExecutionTime * 1000); 50 | } catch (InterruptedException e) { 51 | System.err.println("Could not wait until max specified time, TerminatorThread interrupted."); 52 | return; 53 | } 54 | System.err.println("Maximum time elapsed. Requesting stop for the workload."); 55 | workload.requestStop(); 56 | System.err.println("Stop requested for workload. Now Joining!"); 57 | for (Thread t : threads) { 58 | while (t.isAlive()) { 59 | try { 60 | t.join(waitTimeOutInMS); 61 | if (t.isAlive()) { 62 | System.out.println("Still waiting for thread " + t.getName() + " to complete. " + 63 | "Workload status: " + workload.isStopRequested()); 64 | } 65 | } catch (InterruptedException e) { 66 | // Do nothing. Don't know why I was interrupted. 67 | } 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/UnknownDBException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb; 19 | 20 | /** 21 | * Could not create the specified DB. 22 | */ 23 | public class UnknownDBException extends Exception { 24 | /** 25 | * 26 | */ 27 | private static final long serialVersionUID = 459099842269616836L; 28 | 29 | public UnknownDBException(String message) { 30 | super(message); 31 | } 32 | 33 | public UnknownDBException() { 34 | super(); 35 | } 36 | 37 | public UnknownDBException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | public UnknownDBException(Throwable cause) { 42 | super(cause); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/Utils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb; 19 | 20 | import java.util.Random; 21 | 22 | /** 23 | * Utility functions. 24 | */ 25 | public class Utils { 26 | public static final int FNV_offset_basis_32 = 0x811c9dc5; 27 | public static final int FNV_prime_32 = 16777619; 28 | public static final long FNV_offset_basis_64 = 0xCBF29CE484222325L; 29 | public static final long FNV_prime_64 = 1099511628211L; 30 | private static final Random rand = new Random(); 31 | private static final ThreadLocal rng = new ThreadLocal(); 32 | 33 | public static Random random() { 34 | Random ret = rng.get(); 35 | if (ret == null) { 36 | ret = new Random(rand.nextLong()); 37 | rng.set(ret); 38 | } 39 | return ret; 40 | } 41 | 42 | /** 43 | * Generate a random ASCII string of a given length. 44 | */ 45 | public static String ASCIIString(int length) { 46 | int interval = '~' - ' ' + 1; 47 | 48 | byte[] buf = new byte[length]; 49 | random().nextBytes(buf); 50 | for (int i = 0; i < length; i++) { 51 | if (buf[i] < 0) { 52 | buf[i] = (byte) ((-buf[i] % interval) + ' '); 53 | } 54 | else { 55 | buf[i] = (byte) ((buf[i] % interval) + ' '); 56 | } 57 | } 58 | return new String(buf); 59 | } 60 | 61 | /** 62 | * Hash an integer value. 63 | */ 64 | public static long hash(long val) { 65 | return FNVhash64(val); 66 | } 67 | 68 | /** 69 | * 32 bit FNV hash. Produces more "random" hashes than (say) String.hashCode(). 70 | * 71 | * @param val The value to hash. 72 | * @return The hash value 73 | */ 74 | public static int FNVhash32(int val) { 75 | //from http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash 76 | int hashval = FNV_offset_basis_32; 77 | 78 | for (int i = 0; i < 4; i++) { 79 | int octet = val & 0x00ff; 80 | val = val >> 8; 81 | 82 | hashval = hashval ^ octet; 83 | hashval = hashval * FNV_prime_32; 84 | //hashval = hashval ^ octet; 85 | } 86 | return Math.abs(hashval); 87 | } 88 | 89 | /** 90 | * 64 bit FNV hash. Produces more "random" hashes than (say) String.hashCode(). 91 | * 92 | * @param val The value to hash. 93 | * @return The hash value 94 | */ 95 | public static long FNVhash64(long val) { 96 | //from http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash 97 | long hashval = FNV_offset_basis_64; 98 | 99 | for (int i = 0; i < 8; i++) { 100 | long octet = val & 0x00ff; 101 | val = val >> 8; 102 | 103 | hashval = hashval ^ octet; 104 | hashval = hashval * FNV_prime_64; 105 | //hashval = hashval ^ octet; 106 | } 107 | return Math.abs(hashval); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/WorkloadException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb; 19 | 20 | /** 21 | * The workload tried to do something bad. 22 | */ 23 | public class WorkloadException extends Exception { 24 | /** 25 | * 26 | */ 27 | private static final long serialVersionUID = 8844396756042772132L; 28 | 29 | public WorkloadException(String message) { 30 | super(message); 31 | } 32 | 33 | public WorkloadException() { 34 | super(); 35 | } 36 | 37 | public WorkloadException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | public WorkloadException(Throwable cause) { 42 | super(cause); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/AcknowledgedCounterGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015 YCSB contributors. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.generator; 18 | 19 | import java.util.concurrent.locks.ReentrantLock; 20 | 21 | /** 22 | * A CounterGenerator that reports generated integers via lastInt() 23 | * only after they have been acknowledged. 24 | */ 25 | public class AcknowledgedCounterGenerator extends CounterGenerator 26 | { 27 | /** The size of the window of pending id ack's. 2^20 = {@value} */ 28 | static final int WINDOW_SIZE = Integer.rotateLeft(1, 20); 29 | 30 | /** The mask to use to turn an id into a slot in {@link #window}. */ 31 | private static final int WINDOW_MASK = WINDOW_SIZE - 1; 32 | 33 | private final ReentrantLock lock; 34 | private final boolean[] window; 35 | private volatile long limit; 36 | 37 | /** 38 | * Create a counter that starts at countstart. 39 | */ 40 | public AcknowledgedCounterGenerator(long countstart) 41 | { 42 | super(countstart); 43 | lock = new ReentrantLock(); 44 | window = new boolean[WINDOW_SIZE]; 45 | limit = countstart - 1; 46 | } 47 | 48 | /** 49 | * In this generator, the highest acknowledged counter value 50 | * (as opposed to the highest generated counter value). 51 | */ 52 | @Override 53 | public long lastLong() 54 | { 55 | return limit; 56 | } 57 | 58 | /** 59 | * Make a generated counter value available via lastInt(). 60 | */ 61 | public void acknowledge(long value) 62 | { 63 | final int currentSlot = (int)(value & WINDOW_MASK); 64 | if (window[currentSlot] == true) { 65 | throw new RuntimeException("Too many unacknowledged insertion keys."); 66 | } 67 | 68 | window[currentSlot] = true; 69 | 70 | if (lock.tryLock()) { 71 | // move a contiguous sequence from the window 72 | // over to the "limit" variable 73 | try { 74 | // Only loop through the entire window at most once. 75 | long beforeFirstSlot = (limit & WINDOW_MASK); 76 | long index; 77 | for (index = limit + 1; index != beforeFirstSlot; ++index) { 78 | int slot = (int)(index & WINDOW_MASK); 79 | if (!window[slot]) { 80 | break; 81 | } 82 | 83 | window[slot] = false; 84 | } 85 | 86 | limit = index - 1; 87 | } finally { 88 | lock.unlock(); 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/ConstantLongGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.generator; 18 | 19 | /** 20 | * A trivial integer generator that always returns the same value. 21 | * 22 | * @author sears 23 | * 24 | */ 25 | public class ConstantLongGenerator extends LongGenerator { 26 | private final long i; 27 | 28 | /** 29 | * @param i The integer that this generator will always return. 30 | */ 31 | public ConstantLongGenerator(long i) { 32 | this.i = i; 33 | } 34 | 35 | @Override 36 | public long nextLong() { 37 | return i; 38 | } 39 | 40 | @Override 41 | public double mean() { 42 | return i; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/CounterGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | import java.util.concurrent.atomic.AtomicLong; 21 | 22 | /** 23 | * Generates a sequence of integers 0, 1, ... 24 | */ 25 | public class CounterGenerator extends LongGenerator { 26 | final AtomicLong counter; 27 | /** 28 | * Create a counter that starts at countstart 29 | */ 30 | public CounterGenerator(long countstart) { 31 | counter = new AtomicLong(countstart); 32 | setLastLong(counter.get() - 1); 33 | } 34 | 35 | /** 36 | * If the generator returns numeric (integer) values, return the next value as an int. Default is to return -1, which 37 | * is appropriate for generators that do not return numeric values. 38 | */ 39 | public long nextLong() { 40 | long ret = counter.getAndIncrement(); 41 | setLastLong(ret); 42 | return ret; 43 | } 44 | 45 | @Override 46 | public long lastLong() { 47 | return counter.get() - 1; 48 | } 49 | 50 | @Override 51 | public double mean() { 52 | throw new UnsupportedOperationException("Can't compute mean of non-stationary distribution!"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/DiscreteGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | import com.yahoo.ycsb.Utils; 21 | import com.yahoo.ycsb.WorkloadException; 22 | 23 | import java.util.Vector; 24 | 25 | /** 26 | * Generates a distribution by choosing from a discrete set of values. 27 | */ 28 | public class DiscreteGenerator extends Generator { 29 | Vector _values; 30 | String _lastvalue; 31 | 32 | public DiscreteGenerator() { 33 | _values = new Vector(); 34 | _lastvalue = null; 35 | } 36 | 37 | /** 38 | * Generate the next string in the distribution. 39 | */ 40 | public String nextString() { 41 | double sum = 0; 42 | 43 | for (Pair p : _values) { 44 | sum += p._weight; 45 | } 46 | 47 | double val = Utils.random().nextDouble(); 48 | 49 | for (Pair p : _values) { 50 | if (val < p._weight / sum) { 51 | return p._value; 52 | } 53 | 54 | val -= p._weight / sum; 55 | } 56 | 57 | //should never get here. 58 | System.out.println("oops. should not get here."); 59 | 60 | System.exit(0); 61 | 62 | return null; 63 | } 64 | 65 | /** 66 | * If the generator returns numeric (integer) values, return the next value as an int. Default is to return -1, which 67 | * is appropriate for generators that do not return numeric values. 68 | * 69 | * @throws WorkloadException if this generator does not support integer values 70 | */ 71 | public int nextInt() throws WorkloadException { 72 | throw new WorkloadException("DiscreteGenerator does not support nextLong()"); 73 | } 74 | 75 | /** 76 | * Return the previous string generated by the distribution; e.g., returned from the last nextString() call. 77 | * Calling lastString() should not advance the distribution or have any side effects. If nextString() has not yet 78 | * been called, lastString() should return something reasonable. 79 | */ 80 | public String lastString() { 81 | if (_lastvalue == null) { 82 | _lastvalue = nextString(); 83 | } 84 | return _lastvalue; 85 | } 86 | 87 | public void addValue(double weight, String value) { 88 | _values.add(new Pair(weight, value)); 89 | } 90 | 91 | class Pair { 92 | public double _weight; 93 | public String _value; 94 | 95 | Pair(double weight, String value) { 96 | _weight = weight; 97 | _value = value; 98 | } 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/ExponentialGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2011 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | import com.yahoo.ycsb.Utils; 21 | 22 | /** 23 | * A generator of an exponential distribution. It produces a sequence 24 | * of time intervals (integers) according to an exponential 25 | * distribution. Smaller intervals are more frequent than larger 26 | * ones, and there is no bound on the length of an interval. When you 27 | * construct an instance of this class, you specify a parameter gamma, 28 | * which corresponds to the rate at which events occur. 29 | * Alternatively, 1/gamma is the average length of an interval. 30 | */ 31 | public class ExponentialGenerator extends LongGenerator { 32 | // What percentage of the readings should be within the most recent exponential.frac portion of the dataset? 33 | public static final String EXPONENTIAL_PERCENTILE_PROPERTY = "exponential.percentile"; 34 | public static final String EXPONENTIAL_PERCENTILE_DEFAULT = "95"; 35 | 36 | // What fraction of the dataset should be accessed exponential.percentile of the time? 37 | public static final String EXPONENTIAL_FRAC_PROPERTY = "exponential.frac"; 38 | public static final String EXPONENTIAL_FRAC_DEFAULT = "0.8571428571"; // 1/7 39 | 40 | /** 41 | * The exponential constant to use. 42 | */ 43 | double _gamma; 44 | 45 | /******************************* Constructors **************************************/ 46 | 47 | /** 48 | * Create an exponential generator with a mean arrival rate of 49 | * gamma. (And half life of 1/gamma). 50 | */ 51 | public ExponentialGenerator(double mean) { 52 | _gamma = 1.0 / mean; 53 | } 54 | 55 | public ExponentialGenerator(double percentile, double range) { 56 | _gamma = -Math.log(1.0 - percentile / 100.0) / range; //1.0/mean; 57 | } 58 | 59 | /****************************************************************************************/ 60 | 61 | public static void main(String args[]) { 62 | ExponentialGenerator e = new ExponentialGenerator(90, 100); 63 | int j = 0; 64 | for (int i = 0; i < 1000; i++) { 65 | if (e.nextLong() < 100) { 66 | j++; 67 | } 68 | } 69 | System.out.println("Got " + j + " hits. Expect 900"); 70 | } 71 | 72 | /** 73 | * Generate the next item as a long. 74 | * 75 | * @return The next item in the sequence. 76 | */ 77 | public long nextLong() { 78 | return (long) (-Math.log(Utils.random().nextDouble()) / _gamma); 79 | } 80 | 81 | @Override 82 | public double mean() { 83 | return 1.0 / _gamma; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/FileGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed under the Apache License, Version 2.0 (the "License"); you 3 | * may not use this file except in compliance with the License. You 4 | * may obtain a copy of the License at 5 | *

6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | *

8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 11 | * implied. See the License for the specific language governing 12 | * permissions and limitations under the License. See accompanying 13 | * LICENSE file. 14 | */ 15 | 16 | package com.yahoo.ycsb.generator; 17 | 18 | import java.io.*; 19 | 20 | /** 21 | * A generator, whose sequence is the lines of a file. 22 | */ 23 | public class FileGenerator extends Generator { 24 | String filename; 25 | String current; 26 | BufferedReader reader; 27 | 28 | /** 29 | * Create a FileGenerator with the given file. 30 | * @param _filename The file to read lines from. 31 | */ 32 | public FileGenerator(String _filename) { 33 | try { 34 | filename = _filename; 35 | File file = new File(filename); 36 | FileInputStream in = new FileInputStream(file); 37 | reader = new BufferedReader(new InputStreamReader(in)); 38 | } catch (IOException e) { 39 | System.err.println("Exception: " + e); 40 | } 41 | } 42 | 43 | /** 44 | * Return the next string of the sequence, ie the next line of the file. 45 | */ 46 | public synchronized String nextString() { 47 | try { 48 | return current = reader.readLine(); 49 | } catch (NullPointerException e) { 50 | System.err.println("NullPointerException: " + filename + ':' + current); 51 | throw e; 52 | } catch (IOException e) { 53 | System.err.println("Exception: " + e); 54 | return null; 55 | } 56 | } 57 | 58 | /** 59 | * Return the previous read line. 60 | */ 61 | public String lastString() { 62 | return current; 63 | } 64 | 65 | /** 66 | * Reopen the file to reuse values. 67 | */ 68 | public synchronized void reloadFile() { 69 | try { 70 | System.err.println("Reload " + filename); 71 | reader.close(); 72 | File file = new File(filename); 73 | FileInputStream in = new FileInputStream(file); 74 | reader = new BufferedReader(new InputStreamReader(in)); 75 | } catch (IOException e) { 76 | System.err.println("Exception: " + e); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/Generator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | /** 21 | * An expression that generates a sequence of string values, following some distribution (Uniform, Zipfian, Sequential, etc.) 22 | */ 23 | public abstract class Generator { 24 | /** 25 | * Generate the next string in the distribution. 26 | */ 27 | public abstract String nextString(); 28 | 29 | /** 30 | * Return the previous string generated by the distribution; e.g., returned from the last nextString() call. 31 | * Calling lastString() should not advance the distribution or have any side effects. If nextString() has not yet 32 | * been called, lastString() should return something reasonable. 33 | */ 34 | public abstract String lastString(); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/HistogramGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.generator; 18 | 19 | import com.yahoo.ycsb.Utils; 20 | 21 | import java.io.BufferedReader; 22 | import java.io.FileReader; 23 | import java.io.IOException; 24 | import java.util.ArrayList; 25 | 26 | /** 27 | * Generate integers according to a histogram distribution. The histogram 28 | * buckets are of width one, but the values are multiplied by a block size. 29 | * Therefore, instead of drawing sizes uniformly at random within each 30 | * bucket, we always draw the largest value in the current bucket, so the value 31 | * drawn is always a multiple of block_size. 32 | * 33 | * The minimum value this distribution returns is block_size (not zero). 34 | * 35 | * Modified Nov 19 2010 by sears 36 | * 37 | * @author snjones 38 | * 39 | */ 40 | public class HistogramGenerator extends LongGenerator { 41 | 42 | long block_size; 43 | long[] buckets; 44 | long area; 45 | long weighted_area = 0; 46 | double mean_size = 0; 47 | 48 | public HistogramGenerator(String histogramfile) throws IOException { 49 | BufferedReader in = new BufferedReader(new FileReader(histogramfile)); 50 | String str; 51 | String[] line; 52 | 53 | ArrayList a = new ArrayList(); 54 | 55 | str = in.readLine(); 56 | if (str == null) { 57 | throw new IOException("Empty input file!\n"); 58 | } 59 | line = str.split("\t"); 60 | if (line[0].compareTo("BlockSize") != 0) { 61 | throw new IOException("First line of histogram is not the BlockSize!\n"); 62 | } 63 | block_size = Integer.parseInt(line[1]); 64 | 65 | while ((str = in.readLine()) != null) { 66 | // [0] is the bucket, [1] is the value 67 | line = str.split("\t"); 68 | 69 | a.add(Integer.parseInt(line[0]), Integer.parseInt(line[1])); 70 | } 71 | buckets = new long[a.size()]; 72 | for (int i = 0; i < a.size(); i++) { 73 | buckets[i] = a.get(i); 74 | } 75 | 76 | in.close(); 77 | init(); 78 | } 79 | 80 | public HistogramGenerator(long[] buckets, int block_size) { 81 | this.block_size = block_size; 82 | this.buckets = buckets; 83 | init(); 84 | } 85 | 86 | private void init() { 87 | for (int i = 0; i < buckets.length; i++) { 88 | area += buckets[i]; 89 | weighted_area = i * buckets[i]; 90 | } 91 | // calculate average file size 92 | mean_size = ((double) block_size) * ((double) weighted_area) / (double) (area); 93 | } 94 | 95 | @Override 96 | public long nextLong() { 97 | int number = Utils.random().nextInt((int) area); 98 | int i; 99 | 100 | for (i = 0; i < (buckets.length - 1); i++) { 101 | number -= buckets[i]; 102 | if (number <= 0) { 103 | return (int) ((i + 1) * block_size); 104 | } 105 | } 106 | 107 | return (int) (i * block_size); 108 | } 109 | 110 | @Override 111 | public double mean() { 112 | return mean_size; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/IntegerGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | /** 21 | * A generator that is capable of generating ints as well as strings 22 | * 23 | * @author cooperb 24 | */ 25 | public abstract class IntegerGenerator extends Generator { 26 | int lastint; 27 | 28 | /** 29 | * Set the last value generated. IntegerGenerator subclasses must use this call 30 | * to properly set the last string value, or the lastString() and lastInt() calls won't work. 31 | */ 32 | protected void setLastInt(int last) { 33 | lastint = last; 34 | } 35 | 36 | /** 37 | * Return the next value as an int. When overriding this method, be sure to call setLastString() properly, or the lastString() call won't work. 38 | */ 39 | public abstract int nextLong(); 40 | 41 | /** 42 | * Generate the next string in the distribution. 43 | */ 44 | public String nextString() { 45 | return "" + nextLong(); 46 | } 47 | 48 | /** 49 | * Return the previous string generated by the distribution; e.g., returned from the last nextString() call. 50 | * Calling lastString() should not advance the distribution or have any side effects. If nextString() has not yet 51 | * been called, lastString() should return something reasonable. 52 | */ 53 | @Override 54 | public String lastString() { 55 | return "" + lastInt(); 56 | } 57 | 58 | /** 59 | * Return the previous int generated by the distribution. This call is unique to IntegerGenerator subclasses, and assumes 60 | * IntegerGenerator subclasses always return ints for nextLong() (e.g. not arbitrary strings). 61 | */ 62 | public int lastInt() { 63 | return lastint; 64 | } 65 | 66 | /** 67 | * Return the expected value (mean) of the values this generator will return. 68 | */ 69 | public abstract double mean(); 70 | } 71 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/LongGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | /** 21 | * A generator that is capable of generating ints as well as strings 22 | * 23 | * @author baderas 24 | * 25 | */ 26 | public abstract class LongGenerator extends Generator { 27 | long lastlong; 28 | 29 | /** 30 | * Set the last value generated. IntegerGenerator subclasses must use this call 31 | * to properly set the last string value, or the lastString() and lastInt() calls won't work. 32 | */ 33 | protected void setLastLong(long last) { 34 | lastlong = last; 35 | } 36 | 37 | /** 38 | * Return the next value as an int. When overriding this method, be sure to call setLastString() properly, or the lastString() call won't work. 39 | */ 40 | public abstract long nextLong(); 41 | 42 | /** 43 | * Generate the next string in the distribution. 44 | */ 45 | public String nextString() { 46 | return "" + nextLong(); 47 | } 48 | 49 | /** 50 | * Return the previous string generated by the distribution; e.g., returned from the last nextString() call. 51 | * Calling lastString() should not advance the distribution or have any side effects. If nextString() has not yet 52 | * been called, lastString() should return something reasonable. 53 | */ 54 | @Override 55 | public String lastString() { 56 | return "" + lastLong(); 57 | } 58 | 59 | /** 60 | * Return the previous int generated by the distribution. This call is unique to IntegerGenerator subclasses, and assumes 61 | * IntegerGenerator subclasses always return ints for nextLong() (e.g. not arbitrary strings). 62 | */ 63 | public long lastLong() { 64 | return lastlong; 65 | } 66 | 67 | /** 68 | * Return the expected value (mean) of the values this generator will return. 69 | */ 70 | public abstract double mean(); 71 | } 72 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/SkewedLatestGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | /** 21 | * Generate a popularity distribution of items, skewed to favor recent items significantly more than older items. 22 | */ 23 | public class SkewedLatestGenerator extends LongGenerator { 24 | CounterGenerator _basis; 25 | ZipfianGenerator _zipfian; 26 | 27 | public SkewedLatestGenerator(CounterGenerator basis) { 28 | _basis = basis; 29 | _zipfian = new ZipfianGenerator(_basis.lastLong()); 30 | nextLong(); 31 | } 32 | 33 | public static void main(String[] args) { 34 | SkewedLatestGenerator gen = new SkewedLatestGenerator(new CounterGenerator(1000)); 35 | for (int i = 0; i < Integer.parseInt(args[0]); i++) { 36 | System.out.println(gen.nextString()); 37 | } 38 | 39 | } 40 | 41 | /** 42 | * Generate the next string in the distribution, skewed Zipfian favoring the items most recently returned by the basis generator. 43 | */ 44 | public long nextLong() { 45 | long max = _basis.lastLong(); 46 | long nextlong = max - _zipfian.nextLong(max+1); //+1 because range shoudl be start to end-1 (insertend is exclusive) 47 | setLastLong(nextlong); 48 | return nextlong; 49 | } 50 | 51 | @Override 52 | public double mean() { 53 | throw new UnsupportedOperationException("Can't compute mean of non-stationary distribution!"); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/UniformGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | import java.util.Vector; 21 | 22 | /** 23 | * An expression that generates a random integer in the specified range 24 | */ 25 | public class UniformGenerator extends Generator { 26 | 27 | Vector _values; 28 | String _laststring; 29 | UniformLongGenerator _gen; 30 | 31 | 32 | /** 33 | * Creates a generator that will return strings from the specified set uniformly randomly 34 | */ 35 | @SuppressWarnings("unchecked") 36 | public UniformGenerator(Vector values) { 37 | _values = (Vector) values.clone(); 38 | _laststring = null; 39 | _gen = new UniformLongGenerator(0, values.size() - 1); 40 | } 41 | 42 | /** 43 | * Generate the next string in the distribution. 44 | */ 45 | public String nextString() { 46 | _laststring = _values.elementAt((int) _gen.nextLong()); 47 | return _laststring; 48 | } 49 | 50 | /** 51 | * Return the previous string generated by the distribution; e.g., returned from the last nextString() call. 52 | * Calling lastString() should not advance the distribution or have any side effects. If nextString() has not yet 53 | * been called, lastString() should return something reasonable. 54 | */ 55 | public String lastString() { 56 | if (_laststring == null) { 57 | nextString(); 58 | } 59 | return _laststring; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/generator/UniformLongGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | import com.yahoo.ycsb.Utils; 21 | 22 | /** 23 | * Generates integers randomly uniform from an interval. 24 | */ 25 | public class UniformLongGenerator extends LongGenerator { 26 | long _lb, _ub, _interval; 27 | 28 | /** 29 | * Creates a generator that will return integers uniformly randomly from the interval [lb,ub] inclusive (that is, lb and ub are possible values) 30 | * 31 | * @param lb the lower bound (inclusive) of generated values 32 | * @param ub the upper bound (inclusive) of generated values 33 | */ 34 | public UniformLongGenerator(long lb, long ub) { 35 | _lb = lb; 36 | _ub = ub; 37 | _interval = (_ub - _lb) +1; 38 | } 39 | 40 | @Override 41 | public long nextLong() { 42 | long ret = _lb+(long)(Utils.random().nextDouble()*_interval); 43 | setLastLong(ret); 44 | 45 | return ret; 46 | } 47 | 48 | @Override 49 | public double mean() { 50 | return ((double) ((long) (_lb + _ub))) / 2.0; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/measurements/OneMeasurement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.measurements; 19 | 20 | import java.io.IOException; 21 | import java.util.concurrent.ConcurrentHashMap; 22 | import java.util.Map; 23 | import java.util.concurrent.atomic.AtomicInteger; 24 | 25 | import com.yahoo.ycsb.measurements.exporter.MeasurementsExporter; 26 | 27 | /** 28 | * A single measured metric (such as READ LATENCY) 29 | */ 30 | public abstract class OneMeasurement { 31 | 32 | private final String _name; 33 | private final ConcurrentHashMap _returncodes; 34 | 35 | public String getName() { 36 | return _name; 37 | } 38 | 39 | /** 40 | * @param _name 41 | */ 42 | public OneMeasurement(String _name) { 43 | this._name = _name; 44 | this._returncodes = new ConcurrentHashMap(); 45 | } 46 | 47 | public abstract void measure(long latency); 48 | 49 | public abstract String getSummary(); 50 | 51 | /** 52 | * No need for synchronization, using CHM to deal with that 53 | */ 54 | public void reportReturnCode(int code) { 55 | Integer Icode = code; 56 | AtomicInteger counter = _returncodes.get(Icode); 57 | 58 | if (counter == null) { 59 | AtomicInteger other = _returncodes.putIfAbsent(Icode, counter = new AtomicInteger()); 60 | if (other != null) { 61 | counter = other; 62 | } 63 | } 64 | 65 | counter.incrementAndGet(); 66 | } 67 | 68 | /** 69 | * Export the current measurements to a suitable format. 70 | * 71 | * @param exporter Exporter representing the type of format to write to. 72 | * @throws IOException Thrown if the export failed. 73 | */ 74 | public abstract void exportMeasurements(MeasurementsExporter exporter) throws IOException; 75 | 76 | protected final void exportReturnCodes(MeasurementsExporter exporter) throws IOException { 77 | for (Map.Entry entry : _returncodes.entrySet()) { 78 | exporter.write(getName(), "Return=" + entry.getKey(), entry.getValue().get()); 79 | } 80 | } 81 | } -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/measurements/TwoInOneMeasurement.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.measurements; 19 | 20 | import com.yahoo.ycsb.measurements.exporter.MeasurementsExporter; 21 | import org.HdrHistogram.Recorder; 22 | 23 | import java.io.IOException; 24 | 25 | /** 26 | * delegates to 2 measurement instances. 27 | * @author nitsanw 28 | * 29 | */ 30 | public class TwoInOneMeasurement extends OneMeasurement { 31 | final OneMeasurement thing1,thing2; 32 | public TwoInOneMeasurement(String name, OneMeasurement thing1,OneMeasurement thing2) { 33 | super(name); 34 | this.thing1 = thing1; 35 | this.thing2 = thing2; 36 | } 37 | 38 | /** 39 | * No need for synchronization, using CHM to deal with that 40 | * 41 | * @see com.yahoo.ycsb.OneMeasurement#reportReturnCode(int) 42 | */ 43 | public void reportReturnCode(int code) { 44 | thing1.reportReturnCode(code); 45 | } 46 | 47 | /** 48 | * It appears latency is reported in micros. 49 | * Using {@link Recorder} to support concurrent updates to histogram. 50 | * 51 | * @see com.yahoo.ycsb.OneMeasurement#measure(long) 52 | */ 53 | public void measure(long latencyInMicros) { 54 | thing1.measure(latencyInMicros); 55 | thing2.measure(latencyInMicros); 56 | } 57 | 58 | /** 59 | * This is called from a main thread, on orderly termination. 60 | * 61 | * @see com.yahoo.ycsb.measurements.OneMeasurement#exportMeasurements(com.yahoo.ycsb.measurements.exporter.MeasurementsExporter) 62 | */ 63 | @Override 64 | public void exportMeasurements(MeasurementsExporter exporter) throws IOException { 65 | thing1.exportMeasurements(exporter); 66 | thing2.exportMeasurements(exporter); 67 | } 68 | 69 | /** 70 | * This is called periodically from the StatusThread. There's a single StatusThread per Client process. 71 | * We optionally serialize the interval to log on this opportunity. 72 | * @see com.yahoo.ycsb.measurements.OneMeasurement#getSummary() 73 | */ 74 | @Override 75 | public String getSummary() { 76 | return thing1.getSummary() + "\n" + thing2.getSummary(); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/measurements/exporter/JSONArrayMeasurementsExporter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.measurements.exporter; 18 | 19 | import org.codehaus.jackson.JsonFactory; 20 | import org.codehaus.jackson.JsonGenerator; 21 | import org.codehaus.jackson.util.DefaultPrettyPrinter; 22 | 23 | import java.io.BufferedWriter; 24 | import java.io.IOException; 25 | import java.io.OutputStream; 26 | import java.io.OutputStreamWriter; 27 | 28 | /** 29 | * Export measurements into a machine readable JSON Array of measurement objects. 30 | */ 31 | public class JSONArrayMeasurementsExporter implements MeasurementsExporter { 32 | 33 | private JsonFactory factory = new JsonFactory(); 34 | private JsonGenerator g; 35 | 36 | public JSONArrayMeasurementsExporter(OutputStream os) throws IOException { 37 | BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os)); 38 | g = factory.createJsonGenerator(bw); 39 | g.setPrettyPrinter(new DefaultPrettyPrinter()); 40 | g.writeStartArray(); 41 | } 42 | 43 | public void write(String metric, String measurement, long i) throws IOException { 44 | g.writeStartObject(); 45 | g.writeStringField("metric", metric); 46 | g.writeStringField("measurement", measurement); 47 | g.writeNumberField("value", i); 48 | g.writeEndObject(); 49 | } 50 | 51 | public void write(String metric, String measurement, double d) throws IOException { 52 | g.writeStartObject(); 53 | g.writeStringField("metric", metric); 54 | g.writeStringField("measurement", measurement); 55 | g.writeNumberField("value", d); 56 | g.writeEndObject(); 57 | } 58 | 59 | public void close() throws IOException { 60 | if (g != null) { 61 | g.writeEndArray(); 62 | g.close(); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/measurements/exporter/JSONMeasurementsExporter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.measurements.exporter; 18 | 19 | import org.codehaus.jackson.JsonFactory; 20 | import org.codehaus.jackson.JsonGenerator; 21 | import org.codehaus.jackson.util.DefaultPrettyPrinter; 22 | 23 | import java.io.BufferedWriter; 24 | import java.io.IOException; 25 | import java.io.OutputStream; 26 | import java.io.OutputStreamWriter; 27 | 28 | /** 29 | * Export measurements into a machine readable JSON file. 30 | */ 31 | public class JSONMeasurementsExporter implements MeasurementsExporter { 32 | 33 | private JsonFactory factory = new JsonFactory(); 34 | private JsonGenerator g; 35 | 36 | public JSONMeasurementsExporter(OutputStream os) throws IOException { 37 | 38 | BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os)); 39 | g = factory.createJsonGenerator(bw); 40 | g.setPrettyPrinter(new DefaultPrettyPrinter()); 41 | } 42 | 43 | public void write(String metric, String measurement, long i) throws IOException { 44 | g.writeStartObject(); 45 | g.writeStringField("metric", metric); 46 | g.writeStringField("measurement", measurement); 47 | g.writeNumberField("value", i); 48 | g.writeEndObject(); 49 | } 50 | 51 | public void write(String metric, String measurement, double d) throws IOException { 52 | g.writeStartObject(); 53 | g.writeStringField("metric", metric); 54 | g.writeStringField("measurement", measurement); 55 | g.writeNumberField("value", d); 56 | g.writeEndObject(); 57 | } 58 | 59 | public void close() throws IOException { 60 | if (g != null) { 61 | g.close(); 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/measurements/exporter/MeasurementsExporter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.measurements.exporter; 18 | 19 | import java.io.Closeable; 20 | import java.io.IOException; 21 | 22 | /** 23 | * Used to export the collected measurements into a useful format, for example 24 | * human readable text or machine readable JSON. 25 | */ 26 | public interface MeasurementsExporter extends Closeable { 27 | 28 | /** 29 | * Write a measurement to the exported format. 30 | * 31 | * @param metric Metric name, for example "READ LATENCY". 32 | * @param measurement Measurement name, for example "Average latency". 33 | * @param i Measurement to write. 34 | * @throws IOException if writing failed 35 | */ 36 | void write(String metric, String measurement, long i) throws IOException; 37 | 38 | /** 39 | * Write a measurement to the exported format. 40 | * 41 | * @param metric Metric name, for example "READ LATENCY". 42 | * @param measurement Measurement name, for example "Average latency". 43 | * @param d Measurement to write. 44 | * @throws IOException if writing failed 45 | */ 46 | void write(String metric, String measurement, double d) throws IOException; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/measurements/exporter/TextMeasurementsExporter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.measurements.exporter; 18 | 19 | import java.io.BufferedWriter; 20 | import java.io.IOException; 21 | import java.io.OutputStream; 22 | import java.io.OutputStreamWriter; 23 | 24 | /** 25 | * Write human readable text. Tries to emulate the previous print report method. 26 | */ 27 | public class TextMeasurementsExporter implements MeasurementsExporter { 28 | 29 | private BufferedWriter bw; 30 | 31 | public TextMeasurementsExporter(OutputStream os) { 32 | this.bw = new BufferedWriter(new OutputStreamWriter(os)); 33 | } 34 | 35 | public void write(String metric, String measurement, long i) throws IOException { 36 | bw.write("[" + metric + "], " + measurement + ", " + i); 37 | bw.newLine(); 38 | } 39 | 40 | public void write(String metric, String measurement, double d) throws IOException { 41 | bw.write("[" + metric + "], " + measurement + ", " + d); 42 | bw.newLine(); 43 | } 44 | 45 | public void close() throws IOException { 46 | this.bw.close(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/yahoo/ycsb/workloads/ConstantOccupancyWorkload.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.workloads; 18 | 19 | import com.yahoo.ycsb.Client; 20 | import com.yahoo.ycsb.WorkloadException; 21 | import com.yahoo.ycsb.generator.IntegerGenerator; 22 | import com.yahoo.ycsb.generator.LongGenerator; 23 | 24 | import java.util.Properties; 25 | 26 | /** 27 | * A disk-fragmenting workload. 28 | *

29 | * Properties to control the client: 30 | *

31 | *
    32 | *
  • disksize: how many bytes of storage can the disk store? (default 100,000,000) 33 | *
  • occupancy: what fraction of the available storage should be used? (default 0.9) 34 | *
  • requestdistribution: what distribution should be used to select the records to operate on - uniform, zipfian or latest (default: histogram) 35 | *
36 | * 37 | * 38 | *

See also: 39 | * Russell Sears, Catharine van Ingen. 40 | * Fragmentation in Large Object Repositories, 41 | * CIDR 2006. [Presentation] 42 | *

43 | * 44 | * 45 | * @author sears 46 | * 47 | */ 48 | public class ConstantOccupancyWorkload extends CoreWorkload { 49 | public static final String STORAGE_AGE_PROPERTY = "storageages"; 50 | public static final long STORAGE_AGE_PROPERTY_DEFAULT = 10; 51 | public static final String DISK_SIZE_PROPERTY = "disksize"; 52 | public static final long DISK_SIZE_PROPERTY_DEFAULT = 100 * 1000 * 1000; 53 | public static final String OCCUPANCY_PROPERTY = "occupancy"; 54 | public static final double OCCUPANCY_PROPERTY_DEFAULT = 0.9; 55 | long disksize; 56 | long storageages; 57 | IntegerGenerator objectsizes; 58 | double occupancy; 59 | long object_count; 60 | 61 | @Override 62 | public void init(Properties p) throws WorkloadException { 63 | disksize = Long.parseLong(p.getProperty(DISK_SIZE_PROPERTY, DISK_SIZE_PROPERTY_DEFAULT + "")); 64 | storageages = Long.parseLong(p.getProperty(STORAGE_AGE_PROPERTY, STORAGE_AGE_PROPERTY_DEFAULT + "")); 65 | occupancy = Double.parseDouble(p.getProperty(OCCUPANCY_PROPERTY, OCCUPANCY_PROPERTY_DEFAULT + "")); 66 | 67 | if (p.getProperty(Client.RECORD_COUNT_PROPERTY) != null || 68 | p.getProperty(Client.INSERT_COUNT_PROPERTY) != null || 69 | p.getProperty(Client.OPERATION_COUNT_PROPERTY) != null) { 70 | System.err.println("Warning: record, insert or operation count was set prior to initting ConstantOccupancyWorkload. Overriding old values."); 71 | } 72 | LongGenerator g = CoreWorkload.getTagLengthGenerator(p); 73 | double fieldsize = g.mean(); 74 | int fieldcount = Integer.parseInt(p.getProperty(TAG_COUNT_PROPERTY, TAG_COUNT_PROPERTY_DEFAULT)); 75 | 76 | object_count = (long) (occupancy * ((double) disksize / (fieldsize * (double) fieldcount))); 77 | if (object_count == 0) { 78 | throw new IllegalStateException("Object count was zero. Perhaps disksize is too low?"); 79 | } 80 | p.setProperty(Client.RECORD_COUNT_PROPERTY, object_count + ""); 81 | p.setProperty(Client.OPERATION_COUNT_PROPERTY, (storageages * object_count) + ""); 82 | p.setProperty(Client.INSERT_COUNT_PROPERTY, object_count + ""); 83 | 84 | super.init(p); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /core/src/test/java/com/yahoo/ycsb/TestByteIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012 YCSB contributors. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb; 19 | 20 | import org.testng.annotations.Test; 21 | 22 | import static org.testng.AssertJUnit.*; 23 | 24 | public class TestByteIterator { 25 | @Test 26 | public void testRandomByteIterator() { 27 | int size = 100; 28 | ByteIterator itor = new RandomByteIterator(size); 29 | assertTrue(itor.hasNext()); 30 | assertEquals(size, itor.bytesLeft()); 31 | assertEquals(size, itor.toString().getBytes().length); 32 | assertFalse(itor.hasNext()); 33 | assertEquals(0, itor.bytesLeft()); 34 | 35 | itor = new RandomByteIterator(size); 36 | assertEquals(size, itor.toArray().length); 37 | assertFalse(itor.hasNext()); 38 | assertEquals(0, itor.bytesLeft()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/test/java/com/yahoo/ycsb/generator/AcknowledgedCounterGeneratorTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015 YCSB contributors. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.generator; 18 | 19 | import java.util.Random; 20 | import java.util.concurrent.ArrayBlockingQueue; 21 | import java.util.concurrent.BlockingQueue; 22 | 23 | import org.testng.annotations.Test; 24 | 25 | /** 26 | * Tests for the AcknowledgedCounterGenerator class. 27 | */ 28 | public class AcknowledgedCounterGeneratorTest { 29 | 30 | /** 31 | * Test that advancing past {@link Integer#MAX_VALUE} works. 32 | */ 33 | @Test 34 | public void testIncrementPastIntegerMaxValue() { 35 | final long toTry = AcknowledgedCounterGenerator.WINDOW_SIZE * 3; 36 | 37 | AcknowledgedCounterGenerator generator = 38 | new AcknowledgedCounterGenerator(Integer.MAX_VALUE - 1000); 39 | 40 | Random rand = new Random(System.currentTimeMillis()); 41 | BlockingQueue pending = new ArrayBlockingQueue(1000); 42 | for (long i = 0; i < toTry; ++i) { 43 | long value = generator.nextLong(); 44 | 45 | while (!pending.offer(value)) { 46 | 47 | Long first = pending.poll(); 48 | 49 | // Don't always advance by one. 50 | if (rand.nextBoolean()) { 51 | generator.acknowledge(first); 52 | } else { 53 | Long second = pending.poll(); 54 | pending.add(first); 55 | generator.acknowledge(second); 56 | } 57 | } 58 | } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /core/src/test/java/com/yahoo/ycsb/generator/TestZipfianGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | 18 | package com.yahoo.ycsb.generator; 19 | 20 | import org.testng.annotations.Test; 21 | 22 | import static org.testng.AssertJUnit.assertFalse; 23 | 24 | 25 | public class TestZipfianGenerator { 26 | @Test 27 | public void testMinAndMaxParameter() { 28 | long min = 5; 29 | long max = 10; 30 | ZipfianGenerator zipfian = new ZipfianGenerator(min, max); 31 | 32 | for (int i = 0; i < 10000; i++) { 33 | long rnd = zipfian.nextLong(); 34 | assertFalse(rnd < min); 35 | assertFalse(rnd > max); 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/test/java/com/yahoo/ycsb/measurements/exporter/TestMeasurementsExporter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.measurements.exporter; 18 | 19 | import com.yahoo.ycsb.generator.ZipfianGenerator; 20 | import com.yahoo.ycsb.measurements.Measurements; 21 | import org.codehaus.jackson.JsonNode; 22 | import org.codehaus.jackson.map.ObjectMapper; 23 | import org.testng.annotations.Test; 24 | 25 | import java.io.ByteArrayOutputStream; 26 | import java.io.IOException; 27 | import java.util.Properties; 28 | 29 | import static org.testng.AssertJUnit.assertEquals; 30 | import static org.testng.AssertJUnit.assertTrue; 31 | 32 | public class TestMeasurementsExporter { 33 | @Test 34 | public void testJSONArrayMeasurementsExporter() throws IOException { 35 | Properties props = new Properties(); 36 | props.put(Measurements.MEASUREMENT_TYPE_PROPERTY, "histogram"); 37 | Measurements mm = new Measurements(props); 38 | ByteArrayOutputStream out = new ByteArrayOutputStream(); 39 | JSONArrayMeasurementsExporter export = new JSONArrayMeasurementsExporter(out); 40 | 41 | long min = 5000; 42 | long max = 100000; 43 | ZipfianGenerator zipfian = new ZipfianGenerator(min, max); 44 | for (int i = 0; i < 1000; i++) { 45 | long rnd = zipfian.nextLong(); 46 | mm.measure("UPDATE", rnd); 47 | } 48 | mm.exportMeasurements(export); 49 | export.close(); 50 | 51 | ObjectMapper mapper = new ObjectMapper(); 52 | JsonNode json = mapper.readTree(out.toString("UTF-8")); 53 | assertTrue(json.isArray()); 54 | assertEquals(json.get(0).get("measurement").asText(), "Operations"); 55 | assertEquals(json.get(3).get("measurement").asText(), "MaxLatency(us)"); 56 | assertEquals(json.get(11).get("measurement").asText(), "5"); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /databus/databus-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /databus/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.yahoo.ycsb 6 | binding-parent 7 | 0.4.0 8 | ../binding-parent 9 | 10 | 11 | databus-binding 12 | Databus Binding 13 | 14 | 15 | 16 | com.yahoo.ycsb 17 | core 18 | ${project.version} 19 | provided 20 | 21 | 22 | org.apache.httpcomponents 23 | httpclient 24 | 4.5.2 25 | 26 | 27 | org.json 28 | json 29 | 20151123 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /databus/src/main/java/com/yahoo/ycsb/db/Test.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.ycsb.db; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.ArrayList; 5 | import java.util.HashMap; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import com.yahoo.ycsb.ByteIterator; 9 | import com.yahoo.ycsb.DBException; 10 | import com.yahoo.ycsb.StringByteIterator; 11 | 12 | public class Test { 13 | 14 | public static void main(String[] args) throws DBException { 15 | 16 | DatabusClient client = new DatabusClient(); 17 | client.init(); 18 | 19 | HashMap tagsInsert = new HashMap(); 20 | tagsInsert.put("TAG0", new StringByteIterator("tag0_Val")); 21 | tagsInsert.put("TAG1", new StringByteIterator("tag1_Val")); 22 | tagsInsert.put("TAG2", new StringByteIterator("tag2_Val")); 23 | 24 | // Insert tests 25 | System.out.println(client.insert("usermetric", Timestamp.valueOf("2001-10-19 20:15:00"), 1.0, tagsInsert)); 26 | System.out.println(client.insert("usermetric", Timestamp.valueOf("2016-02-11 10:59:50"), 2.0, tagsInsert)); 27 | System.out.println(client.insert("usermetric", Timestamp.valueOf("2016-02-11 11:00:00"), 3.0, tagsInsert)); 28 | System.out.println(client.insert("usermetric", Timestamp.valueOf("2016-02-11 11:15:00"), 4.0, tagsInsert)); 29 | System.out.println(client.insert("usermetric", Timestamp.valueOf("2016-02-11 11:16:00"), 5.0, tagsInsert)); 30 | 31 | HashMap> tagsQuery = new HashMap>(); 32 | 33 | ArrayList tag0Values = new ArrayList(); 34 | tag0Values.add("tag0_Val"); 35 | tag0Values.add("tag0_Val2"); 36 | tagsQuery.put("TAG0", tag0Values); 37 | 38 | ArrayList tag1Values = new ArrayList(); 39 | tag1Values.add("tag1_Val"); 40 | tag1Values.add("tag1_Val2"); 41 | 42 | tagsQuery.put("TAG1", tag1Values); 43 | 44 | ArrayList tag2Values = new ArrayList(); 45 | tag2Values.add("tag2_Val"); 46 | tag2Values.add("tag2_Val2"); 47 | tagsQuery.put("TAG2", tag2Values); 48 | 49 | // Read tests 50 | System.out.println(client.read("usermetric", Timestamp.valueOf("2001-10-19 20:15:00"), tagsQuery)); 51 | System.out.println(client.read("usermetric", Timestamp.valueOf("2016-02-11 11:00:00"), tagsQuery)); 52 | 53 | // Reading not existing records => should return -1 54 | System.out.println(client.read("usermetric", Timestamp.valueOf("2013-01-20 00:00:01"), tagsQuery)); 55 | 56 | // Scan tests 57 | System.out.println(client.scan("usermetric", Timestamp.valueOf("2016-02-11 10:00:00"), 58 | Timestamp.valueOf("2016-02-11 11:30:00"), tagsQuery, false, false, false, 10, TimeUnit.MINUTES)); 59 | 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /druid/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | druid-binding 12 | Druid Binding 13 | jar 14 | 15 | 16 | log4j 17 | log4j 18 | 1.2.17 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | io.druid 27 | tranquility_2.10 28 | 0.5.1 29 | 30 | 31 | sigar 32 | org.hyperic 33 | 34 | 35 | 36 | 37 | org.json 38 | json 39 | 20140107 40 | 41 | 42 | org.apache.httpcomponents 43 | httpclient 44 | 4.5 45 | 46 | 47 | com.yahoo.ycsb 48 | core 49 | ${project.version} 50 | provided 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /elasticsearch/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.yahoo.ycsb 6 | binding-parent 7 | 0.4.0 8 | ../binding-parent 9 | 10 | elasticsearch-binding 11 | Elasticsearch Binding 12 | 13 | 14 | 15 | com.yahoo.ycsb 16 | core 17 | ${project.version} 18 | provided 19 | 20 | 21 | org.elasticsearch 22 | elasticsearch 23 | 2.1.1 24 | 25 | 26 | commons-io 27 | commons-io 28 | 2.4 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /elasticsearch/src/main/java/com/yahoo/ycsb/db/Test.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.ycsb.db; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.ArrayList; 5 | import java.util.HashMap; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import com.yahoo.ycsb.ByteIterator; 9 | import com.yahoo.ycsb.StringByteIterator; 10 | 11 | public class Test { 12 | 13 | public static void main(String[] args) { 14 | 15 | try { 16 | 17 | ElasticsearchClient el = new ElasticsearchClient(); 18 | el.init(); 19 | 20 | HashMap tags = new HashMap(); 21 | tags.put("tag1", new StringByteIterator("tag1Val1")); 22 | tags.put("tag2", new StringByteIterator("tag2Val1")); 23 | 24 | el.insert("abcd", Timestamp.valueOf("2015-1-1 13:10:54.324"), 100, tags); 25 | el.insert("abcd", Timestamp.valueOf("2015-2-1 13:10:54.324"), 200, tags); 26 | el.insert("abcd", Timestamp.valueOf("2015-2-2 13:10:54.324"), 300, tags); 27 | 28 | // ------------------------------- 29 | 30 | HashMap> expecTags = new HashMap>(); 31 | 32 | ArrayList tagVals = new ArrayList(); 33 | tagVals.add("tag1Val1"); 34 | tagVals.add("tag1Val2"); 35 | tagVals.add("tag1Val3"); 36 | ArrayList tagVals2 = new ArrayList(); 37 | tagVals2.add("tag2Val1"); 38 | 39 | expecTags.put("tag1", tagVals); 40 | expecTags.put("tag2", tagVals2); 41 | 42 | System.out.println(el.read("abcd", Timestamp.valueOf("2015-1-1 13:10:54.324"), expecTags)); 43 | 44 | // reading from not existing metric / index 45 | System.out.println(el.read("notexist", Timestamp.valueOf("2015-1-1 13:10:54.324"), expecTags)); 46 | 47 | System.out.println(el.scan("abcd", Timestamp.valueOf("2015-1-1 13:10:00.000"), 48 | Timestamp.valueOf("2015-2-4 00:00:00.000"), expecTags, false, false, true, 10, TimeUnit.DAYS)); 49 | 50 | } catch (Exception e) { 51 | e.printStackTrace(); 52 | } 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /elasticsearch/src/main/resources/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "*", 3 | "settings": { 4 | "index": { 5 | "refresh_interval": "-1" 6 | } 7 | }, 8 | "mappings": { 9 | "_default_": { 10 | "_all": { 11 | "enabled": false 12 | }, 13 | "_source": { 14 | "enabled": false 15 | }, 16 | "properties": { 17 | "timestamp": { 18 | "type": "date", 19 | "format": "epoch_millis", 20 | "doc_values": true 21 | }, 22 | "value": { 23 | "type": "double", 24 | "index": "no", 25 | "doc_values": true 26 | } 27 | }, 28 | "dynamic_templates": [ 29 | { 30 | "tags": { 31 | "match": "*", 32 | "match_mapping_type": "string", 33 | "mapping": { 34 | "type": "string", 35 | "index": "not_analyzed", 36 | "doc_values": true 37 | } 38 | } 39 | } 40 | ] 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /gnocchi/gnocchi-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /gnocchi/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.yahoo.ycsb 6 | binding-parent 7 | 0.4.0 8 | ../binding-parent 9 | 10 | gnocchi-binding 11 | 12 | 13 | com.yahoo.ycsb 14 | core 15 | ${project.version} 16 | provided 17 | 18 | 19 | org.apache.httpcomponents 20 | httpclient 21 | 4.5.1 22 | 23 | 24 | org.json 25 | json 26 | 20151123 27 | 28 | 29 | 30 | Gnocchi Binding 31 | 32 | -------------------------------------------------------------------------------- /graphite/graphite-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /graphite/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.yahoo.ycsb 6 | binding-parent 7 | 0.4.0 8 | ../binding-parent 9 | 10 | 11 | graphite-binding 12 | Graphite Binding 13 | 14 | 15 | 16 | com.yahoo.ycsb 17 | core 18 | ${project.version} 19 | provided 20 | 21 | 22 | org.apache.httpcomponents 23 | httpclient 24 | 4.5.1 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /graphite/src/main/java/com/yahoo/ycsb/db/Test.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.ycsb.db; 2 | 3 | import java.sql.Timestamp; 4 | //import java.time.Instant; 5 | import java.util.concurrent.TimeUnit; 6 | 7 | import com.yahoo.ycsb.DBException; 8 | 9 | public class Test { 10 | 11 | public static void main(String[] args) throws DBException { 12 | 13 | GraphiteClient graphiteClient = new GraphiteClient(); 14 | graphiteClient.init(); 15 | 16 | // Insert tests 17 | //System.out.println(graphiteClient.insert("metric1", Timestamp.valueOf("2001-10-18 20:15:00"), 1.0, null)); 18 | // System.out.println(graphiteClient.insert("metric1", Timestamp.valueOf("2013-01-19 00:00:00"), 2.0, null)); 19 | System.out.println(graphiteClient.insert("metric2", Timestamp.valueOf("2015-08-10 21:10:05"), 3.0, null)); 20 | 21 | // Record with time stamp in future should not be inserted 22 | //Instant now = Instant.now(); 23 | //Instant tenMinLater = Instant.ofEpochSecond(now.getEpochSecond()+ 600); 24 | //System.out.println(graphiteClient.insert("metric3", Timestamp.from(tenMinLater), 4.0, null)); 25 | 26 | // waits some time, so it's guaranteed that Carbon has forwarded the new records to the TSDB 27 | try { 28 | Thread.sleep(2000); 29 | } catch (InterruptedException e) { 30 | e.printStackTrace(); 31 | } 32 | 33 | // Read tests 34 | //System.out.println(graphiteClient.read("metric1", Timestamp.valueOf("2001-10-18 20:15:00"), null)); 35 | System.out.println(graphiteClient.read("metric2", Timestamp.valueOf("2015-08-10 21:10:05"), null)); 36 | 37 | // reading not existing records => should return -1 38 | //System.out.println(graphiteClient.read("metric3", Timestamp.from(tenMinLater), null)); 39 | // System.out.println(graphiteClient.read("metric1", Timestamp.valueOf("2016-02-14 22:00:00"), null)); 40 | 41 | // Scan tests 42 | //graphiteClient.scan("metric1", Timestamp.valueOf("2016-01-17 20:15:00"), Timestamp.valueOf("2016-01-20 00:00:00"), null, false, false, true, 10, TimeUnit.MINUTES); 43 | 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /h5serv/h5serv-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /h5serv/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | h5serv-binding 13 | H5serv Binding 14 | jar 15 | 16 | 17 | 18 | org.json 19 | json 20 | 20140107 21 | 22 | 23 | org.apache.httpcomponents 24 | httpclient 25 | 4.5 26 | 27 | 28 | com.yahoo.ycsb 29 | core 30 | ${project.version} 31 | provided 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /h5serv/src/main/java/com/yahoo/ycsb/db/HttpGetWithEntity.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.ycsb.db; 2 | 3 | import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; 4 | 5 | import java.net.URI; 6 | 7 | /** 8 | * Created by Andreas Bader on 14.02.16. 9 | */ 10 | public class HttpGetWithEntity extends HttpEntityEnclosingRequestBase { 11 | public final static String METHOD_NAME = "GET"; 12 | 13 | public HttpGetWithEntity(URI url) { 14 | super.setURI(url); 15 | } 16 | 17 | public HttpGetWithEntity(String url) { 18 | super.setURI(URI.create(url)); 19 | } 20 | 21 | @Override 22 | public String getMethod() { 23 | return METHOD_NAME; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /hana/hana-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /hana/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | 13 | clojars.org 14 | http://clojars.org/repo 15 | 16 | 17 | hana-binding 18 | JDBC DB Binding 19 | jar 20 | 21 | 22 | 23 | org.apache.openjpa 24 | openjpa-jdbc 25 | ${openjpa.jdbc.version} 26 | 27 | 28 | com.yahoo.ycsb 29 | core 30 | ${project.version} 31 | provided 32 | 33 | 34 | monetdb 35 | monetdb-jdbc 36 | 2.18 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /hana/src/main/conf/hana.properties: -------------------------------------------------------------------------------- 1 | db.driver=com.sap.db.jdbc.Driver 2 | db.url=jdbc:sap://192.168.209.221:30013/?databaseName=SYSTEMDB 3 | db.user=SYSTEM 4 | db.passwd= 5 | -------------------------------------------------------------------------------- /hana/src/main/java/com/yahoo/ycsb/db/JdbcDBClientConstants.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.ycsb.db; 2 | 3 | /** 4 | * Constants used by the JDBC client. 5 | * 6 | * @author sudipto 7 | * 8 | */ 9 | public interface JdbcDBClientConstants { 10 | 11 | /** The class to use as the jdbc driver. */ 12 | public static final String DRIVER_CLASS = "db.driver"; 13 | 14 | /** The URL to connect to the database. */ 15 | public static final String CONNECTION_URL = "db.url"; 16 | 17 | /** The user name to use to connect to the database. */ 18 | public static final String CONNECTION_USER = "db.user"; 19 | 20 | /** The password to use for establishing the connection. */ 21 | public static final String CONNECTION_PASSWD = "db.passwd"; 22 | 23 | /** The JDBC fetch size hinted to the driver. */ 24 | public static final String JDBC_FETCH_SIZE = "jdbc.fetchsize"; 25 | 26 | /** The JDBC connection auto-commit property for the driver. */ 27 | public static final String JDBC_AUTO_COMMIT = "jdbc.autocommit"; 28 | 29 | /** The name of the property for the number of fields in a record. */ 30 | public static final String FIELD_COUNT_PROPERTY = "fieldcount"; 31 | 32 | /** Default number of fields in a record. */ 33 | public static final String FIELD_COUNT_PROPERTY_DEFAULT = "10"; 34 | 35 | /** Representing a NULL value. */ 36 | public static final String NULL_VALUE = "NULL"; 37 | 38 | /** The code to return when the call succeeds. */ 39 | public static final int SUCCESS = 0; 40 | 41 | /** The Timestamp key in the user table.*/ 42 | public static String TIMESTAMP_KEY = "YCSB_KEY"; 43 | } 44 | -------------------------------------------------------------------------------- /hana/src/main/resources/sql/README: -------------------------------------------------------------------------------- 1 | Contains all the SQL statements used by the JDBC client. 2 | -------------------------------------------------------------------------------- /hana/src/main/resources/sql/create_table.monetdb: -------------------------------------------------------------------------------- 1 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 2 | CREATE TABLE test.usermetric( 3 | ID INT AUTO_INCREMENT PRIMARY KEY, 4 | YCSB_KEY TIMESTAMP, 5 | VALUE DOUBLE, 6 | TAG0 TEXT, TAG1 TEXT, 7 | TAG2 TEXT, TAG3 TEXT, 8 | TAG4 TEXT, TAG5 TEXT, 9 | TAG6 TEXT, TAG7 TEXT, 10 | TAG8 TEXT, TAG9 TEXT); 11 | -------------------------------------------------------------------------------- /hana/src/main/resources/sql/create_table.mysql: -------------------------------------------------------------------------------- 1 | -- Creates a Table. 2 | -- see https://github.com/brianfrankcooper/YCSB/blob/master/jdbc/src/main/resources/sql/create_table.mysql 3 | 4 | -- Drop the table if it exists; 5 | DROP TABLE IF EXISTS test.usermetric; 6 | 7 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 8 | CREATE TABLE test.usermetric( 9 | ID INT AUTO_INCREMENT PRIMARY KEY, 10 | YCSB_KEY TIMESTAMP, 11 | VALUE DOUBLE, 12 | TAG0 TEXT, TAG1 TEXT, 13 | TAG2 TEXT, TAG3 TEXT, 14 | TAG4 TEXT, TAG5 TEXT, 15 | TAG6 TEXT, TAG7 TEXT, 16 | TAG8 TEXT, TAG9 TEXT); 17 | -------------------------------------------------------------------------------- /hana/src/main/resources/sql/create_table.psql: -------------------------------------------------------------------------------- 1 | -- Creates a Table. 2 | 3 | -- Drop the table if it exists; 4 | DROP TABLE IF EXISTS usermetric; 5 | 6 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 7 | CREATE TABLE usermetric( 8 | ID SERIAL PRIMARY KEY, 9 | YCSB_KEY TIMESTAMP, 10 | VALUE DOUBLE PRECISION, 11 | TAG0 TEXT, TAG1 TEXT, 12 | TAG2 TEXT, TAG3 TEXT, 13 | TAG4 TEXT, TAG5 TEXT, 14 | TAG6 TEXT, TAG7 TEXT, 15 | TAG8 TEXT, TAG9 TEXT); 16 | -------------------------------------------------------------------------------- /hana/src/main/resources/sql/create_table.sql: -------------------------------------------------------------------------------- 1 | -- Creates a Table. 2 | 3 | -- Drop the table if it exists; 4 | DROP TABLE IF EXISTS usermetric; 5 | 6 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 7 | CREATE TABLE usermetric( 8 | ID INT IDENTITY(1,1) PRIMARY KEY, 9 | YCSB_KEY TIMESTAMP, 10 | VALUE DOUBLE PRECISION, 11 | TAG0 VARCHAR, TAG1 VARCHAR, 12 | TAG2 VARCHAR, TAG3 VARCHAR, 13 | TAG4 VARCHAR, TAG5 VARCHAR, 14 | TAG6 VARCHAR, TAG7 VARCHAR, 15 | TAG8 VARCHAR, TAG9 VARCHAR); 16 | -------------------------------------------------------------------------------- /influxdb-java/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## v1.3 [unreleased] 2 | 3 | #### Features 4 | 5 | - Compatible with InfluxDB Version up to 0.8 6 | - API: add a InfluxDB#createDatabase(DatabaseConfiguration) to be able to create a new Database with ShardSpaces defined. 7 | - API: introduction of InfluxDB#createShardSpare, InfluxDB#getShardSpace and InfluxDB#dropShardSpace 8 | - API: deprecated InfluxDB#createShard, InfluxDB#getShards and InfluxDB#dropShard, this is replaced with shardSpaces in InfluxDB >= 0.8.0 9 | - API: renamed InfluxDB#deletePoints to InfluxDB#deleteSeries because this is what it actually does. 10 | - [Issue #14] update docker-java for tests to 0.10.0 11 | - Update retrofit from 1.6.0 -> 1.6.1 12 | - Use ms instead of m for millisecond timeprecision. 13 | 14 | ## v1.2 [2014-06-28] 15 | 16 | #### Features 17 | 18 | - [Issue #2] (https://github.com/influxdb/influxdb-java/issues/2) Implement the last missing api calls ( interfaces, sync, forceCompaction, servers, shards) 19 | - use (http://square.github.io/okhttp/, okhttp) instead of java builtin httpconnection to get failover for the http endpoint. 20 | 21 | #### Tasks 22 | 23 | - [Issue #8] (https://github.com/influxdb/influxdb-java/issues/8) Use com.github.docker-java which replaces com.kpelykh for Integration tests. 24 | - [Issue #6] (https://github.com/influxdb/influxdb-java/issues/6) Update Retrofit to 1.6.0 25 | - [Issue #7] (https://github.com/influxdb/influxdb-java/issues/7) Update Guava to 17.0 26 | - fix dependency to guava. 27 | 28 | ## v1.1 [2014-05-31] 29 | 30 | #### Features 31 | 32 | - Add InfluxDB#version() to get the InfluxDB Server version information. 33 | - Changed InfluxDB#createDatabase() to match (https://github.com/influxdb/influxdb/issues/489) without replicationFactor. 34 | - Updated Retrofit from 1.5.0 -> 1.5.1 35 | 36 | ## v1.0 [2014-05-6] 37 | 38 | * Initial Release 39 | -------------------------------------------------------------------------------- /influxdb-java/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | MAINTAINER Stefan Majer 3 | 4 | ADD https://s3.amazonaws.com/influxdb/influxdb_0.9.1_amd64.deb /influxdb_latest_amd64.deb 5 | RUN dpkg -i /influxdb_latest_amd64.deb 6 | 7 | EXPOSE 8083 8086 8 | 9 | CMD ["/opt/influxdb/influxd"] 10 | -------------------------------------------------------------------------------- /influxdb-java/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) {{{year}}} {{{fullname}}} 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /influxdb-java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | com.yahoo.ycsb 6 | binding-parent 7 | 0.4.0 8 | ../binding-parent 9 | 10 | 11 | 4.0.0 12 | org.influxdb 13 | influxdb-java 14 | jar 15 | 2.0-GIT 16 | influxdb java bindings 17 | Java API to access the InfluxDB REST API 18 | http://www.influxdb.org 19 | 20 | 21 | 3.2.1 22 | 23 | 24 | 25 | 26 | The MIT License (MIT) 27 | http://www.opensource.org/licenses/mit-license.php 28 | repo 29 | 30 | 31 | 32 | UTF-8 33 | 34 | 35 | 36 | scm:git:git@github.com:influxdb/influxdb-java.git 37 | scm:git:git@github.com:influxdb/influxdb-java.git 38 | git@github.com:influxdb/influxdb-java.git 39 | 40 | 41 | 42 | 43 | jvshahid 44 | John Shahid 45 | john@influxdb.com 46 | 47 | 48 | majst01 49 | Stefan Majer 50 | stefan.majer@gmail.com 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | org.apache.maven.plugins 59 | maven-compiler-plugin 60 | 61 | 1.7 62 | 1.7 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | org.testng 71 | testng 72 | 6.9.4 73 | test 74 | 75 | 76 | org.assertj 77 | assertj-core 78 | 2.1.0 79 | test 80 | 81 | 82 | com.github.docker-java 83 | docker-java 84 | 1.3.0 85 | test 86 | 87 | 88 | org.mockito 89 | mockito-all 90 | 1.10.19 91 | test 92 | 93 | 94 | com.google.guava 95 | guava 96 | 18.0 97 | 98 | 99 | com.squareup.retrofit 100 | retrofit 101 | 1.9.0 102 | 103 | 105 | 106 | com.squareup.okhttp 107 | okhttp 108 | 2.4.0 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /influxdb-java/src/main/java/org/influxdb/InfluxDBFactory.java: -------------------------------------------------------------------------------- 1 | package org.influxdb; 2 | 3 | import org.influxdb.impl.InfluxDBImpl; 4 | import com.google.common.base.Preconditions; 5 | import com.google.common.base.Strings; 6 | 7 | /** 8 | * A Factory to create a instance of a InfluxDB Database adapter. 9 | * 10 | * @author stefan.majer [at] gmail.com 11 | * 12 | */ 13 | public enum InfluxDBFactory { 14 | ; 15 | /** 16 | * Create a connection to a InfluxDB. 17 | * 18 | * @param url 19 | * the url to connect to. 20 | * @param username 21 | * the username which is used to authorize against the influxDB instance. 22 | * @param password 23 | * the password for the username which is used to authorize against the influxDB 24 | * instance. 25 | * @return a InfluxDB adapter suitable to access a InfluxDB. 26 | */ 27 | public static InfluxDB connect(final String url, final String username, final String password) { 28 | Preconditions.checkArgument(!Strings.isNullOrEmpty(url), "The URL may not be null or empty."); 29 | Preconditions.checkArgument(!Strings.isNullOrEmpty(username), "The username may not be null or empty."); 30 | return new InfluxDBImpl(url, username, password); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /influxdb-java/src/main/java/org/influxdb/dto/Pong.java: -------------------------------------------------------------------------------- 1 | package org.influxdb.dto; 2 | 3 | import com.google.common.base.MoreObjects; 4 | 5 | /** 6 | * Representation of the response for a influxdb ping. 7 | * 8 | * @author stefan.majer [at] gmail.com 9 | * 10 | */ 11 | public class Pong { 12 | private String version; 13 | private long responseTime; 14 | 15 | /** 16 | * @return the status 17 | */ 18 | public String getVersion() { 19 | return this.version; 20 | } 21 | 22 | /** 23 | * @param version 24 | * the status to set 25 | */ 26 | public void setVersion(final String version) { 27 | this.version = version; 28 | } 29 | 30 | /** 31 | * @return the responseTime 32 | */ 33 | public long getResponseTime() { 34 | return this.responseTime; 35 | } 36 | 37 | /** 38 | * @param responseTime 39 | * the responseTime to set 40 | */ 41 | public void setResponseTime(final long responseTime) { 42 | this.responseTime = responseTime; 43 | } 44 | 45 | /** 46 | * {@inheritDoc} 47 | */ 48 | @Override 49 | public String toString() { 50 | return MoreObjects 51 | .toStringHelper(this.getClass()) 52 | .add("version", this.version) 53 | .add("responseTime", this.responseTime) 54 | .toString(); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /influxdb-java/src/main/java/org/influxdb/dto/Query.java: -------------------------------------------------------------------------------- 1 | package org.influxdb.dto; 2 | 3 | /** 4 | * Represents a Query against Influxdb. 5 | * 6 | * @author stefan.majer [at] gmail.com 7 | * 8 | */ 9 | public class Query { 10 | 11 | private final String command; 12 | private final String database; 13 | 14 | /** 15 | * @param command 16 | * @param database 17 | */ 18 | public Query(final String command, final String database) { 19 | super(); 20 | this.command = command; 21 | this.database = database; 22 | } 23 | 24 | /** 25 | * @return the command 26 | */ 27 | public String getCommand() { 28 | return this.command; 29 | } 30 | 31 | /** 32 | * @return the database 33 | */ 34 | public String getDatabase() { 35 | return this.database; 36 | } 37 | 38 | @Override 39 | public int hashCode() { 40 | final int prime = 31; 41 | int result = 1; 42 | result = prime * result + ((command == null) ? 0 : command.hashCode()); 43 | result = prime * result 44 | + ((database == null) ? 0 : database.hashCode()); 45 | return result; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object obj) { 50 | if (this == obj) 51 | return true; 52 | if (obj == null) 53 | return false; 54 | if (getClass() != obj.getClass()) 55 | return false; 56 | Query other = (Query) obj; 57 | if (command == null) { 58 | if (other.command != null) 59 | return false; 60 | } else if (!command.equals(other.command)) 61 | return false; 62 | if (database == null) { 63 | if (other.database != null) 64 | return false; 65 | } else if (!database.equals(other.database)) 66 | return false; 67 | return true; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /influxdb-java/src/main/java/org/influxdb/impl/InfluxDBErrorHandler.java: -------------------------------------------------------------------------------- 1 | package org.influxdb.impl; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStreamReader; 5 | 6 | import retrofit.ErrorHandler; 7 | import retrofit.RetrofitError; 8 | import retrofit.client.Response; 9 | 10 | import com.google.common.base.Charsets; 11 | import com.google.common.io.CharStreams; 12 | 13 | class InfluxDBErrorHandler implements ErrorHandler { 14 | @Override 15 | public Throwable handleError(final RetrofitError cause) { 16 | Response r = cause.getResponse(); 17 | if (r != null && r.getStatus() >= 400) { 18 | try (InputStreamReader reader = new InputStreamReader(r.getBody().in(), Charsets.UTF_8)) { 19 | return new RuntimeException(CharStreams.toString(reader)); 20 | } catch (IOException e) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | return cause; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /influxdb-java/src/main/java/org/influxdb/impl/InfluxDBService.java: -------------------------------------------------------------------------------- 1 | package org.influxdb.impl; 2 | 3 | import org.influxdb.dto.QueryResult; 4 | import retrofit.client.Response; 5 | import retrofit.http.Body; 6 | import retrofit.http.GET; 7 | import retrofit.http.Headers; 8 | import retrofit.http.POST; 9 | import retrofit.http.Query; 10 | import retrofit.mime.TypedString; 11 | 12 | interface InfluxDBService { 13 | 14 | public static final String U = "u"; 15 | public static final String P = "p"; 16 | public static final String Q = "q"; 17 | public static final String DB = "db"; 18 | public static final String RP = "rp"; 19 | public static final String PRECISION = "precision"; 20 | public static final String CONSISTENCY = "consistency"; 21 | public static final String EPOCH = "epoch"; 22 | 23 | @GET("/ping") 24 | public Response ping(); 25 | 26 | // db: required The database to write points 27 | // rp: optional The retention policy to write points. If not specified, the default retention 28 | // policy will be used. 29 | // precision: optional The precision of the time stamps (n, u, ms, s,m,h). If not specified, n 30 | // is used. 31 | // consistency: optional The write consistency level required for the write to succeed. Can be 32 | // one of one, any, all,quorum. Defaults to all. 33 | // u: optional The username for authentication 34 | // p: optional The password for authentication 35 | @Headers("Content-Type: text/plain") 36 | @POST("/write") 37 | public Response writePoints(@Query(U) String username, @Query(P) String password, @Query(DB) String database, 38 | @Query(RP) String retentionPolicy, @Query(PRECISION) String precision, 39 | @Query(CONSISTENCY) String consistency, @Body TypedString batchPoints); 40 | 41 | @GET("/query") 42 | public QueryResult query(@Query(U) String username, @Query(P) String password, @Query(DB) String db, 43 | @Query(EPOCH) String epoch, @Query(Q) String query); 44 | 45 | @GET("/query") 46 | public QueryResult query(@Query(U) String username, @Query(P) String password, @Query(DB) String db, 47 | @Query(Q) String query); 48 | 49 | @GET("/query") 50 | public QueryResult query(@Query(U) String username, @Query(P) String password, @Query(Q) String query); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /influxdb-java/src/main/java/org/influxdb/impl/TimeUtil.java: -------------------------------------------------------------------------------- 1 | package org.influxdb.impl; 2 | 3 | import java.util.EnumSet; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | /** 7 | * Utils for time related methods. 8 | * 9 | * @author stefan.majer [at] gmail.com 10 | * 11 | */ 12 | public enum TimeUtil { 13 | ; 14 | /** 15 | * Convert from a TimeUnit to a influxDB timeunit String. 16 | * 17 | * @param t 18 | * @return the String representation. 19 | */ 20 | public static String toTimePrecision(final TimeUnit t) { 21 | switch (t) { 22 | case HOURS: 23 | return "h"; 24 | case MINUTES: 25 | return "m"; 26 | case SECONDS: 27 | return "s"; 28 | case MILLISECONDS: 29 | return "ms"; 30 | case MICROSECONDS: 31 | return "u"; 32 | case NANOSECONDS: 33 | return "n"; 34 | default: 35 | EnumSet allowedTimeunits = EnumSet.of( 36 | TimeUnit.HOURS, 37 | TimeUnit.MINUTES, 38 | TimeUnit.SECONDS, 39 | TimeUnit.MILLISECONDS, 40 | TimeUnit.MICROSECONDS, 41 | TimeUnit.NANOSECONDS); 42 | throw new IllegalArgumentException("time precision must be one of:" + allowedTimeunits); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /influxdb/influxdb-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /influxdb/influxdb.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /influxdb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | influxdb-binding 13 | InfluxDB Binding 14 | jar 15 | 16 | 17 | org.influxdb 18 | influxdb-java 19 | 2.0-GIT 20 | 21 | 22 | com.yahoo.ycsb 23 | core 24 | ${project.version} 25 | provided 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /jdbc/jdbc-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /jdbc/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 4.0.0 21 | 22 | com.yahoo.ycsb 23 | binding-parent 24 | 0.4.0 25 | ../binding-parent 26 | 27 | 28 | 29 | clojars.org 30 | http://clojars.org/repo 31 | 32 | 33 | jdbc-binding 34 | JDBC DB Binding 35 | jar 36 | 37 | 38 | 39 | org.apache.openjpa 40 | openjpa-jdbc 41 | ${openjpa.jdbc.version} 42 | 43 | 44 | com.yahoo.ycsb 45 | core 46 | ${project.version} 47 | provided 48 | 49 | 50 | monetdb 51 | monetdb-jdbc 52 | 2.18 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /jdbc/src/main/conf/db.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 YCSB contributors. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you 4 | # may not use this file except in compliance with the License. You 5 | # may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. See the License for the specific language governing 13 | # permissions and limitations under the License. See accompanying 14 | # LICENSE file. 15 | 16 | # Properties file that contains database connection information. 17 | 18 | jdbc.driver=org.h2.Driver 19 | # jdbc.fetchsize=20 20 | db.url=jdbc:h2:tcp://foo.com:9092/~/h2/ycsb 21 | db.user=sa 22 | db.passwd= 23 | -------------------------------------------------------------------------------- /jdbc/src/main/conf/h2.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 YCSB contributors. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you 4 | # may not use this file except in compliance with the License. You 5 | # may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. See the License for the specific language governing 13 | # permissions and limitations under the License. See accompanying 14 | # LICENSE file. 15 | 16 | # Properties file that contains database connection information. 17 | 18 | jdbc.driver=org.h2.Driver 19 | db.url=jdbc:h2:tcp://foo.com:9092/~/h2/ycsb 20 | db.user=sa 21 | db.passwd= 22 | -------------------------------------------------------------------------------- /jdbc/src/main/java/com/yahoo/ycsb/db/JdbcDBClientConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 Yahoo! Inc. All rights reserved. 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); you 5 | * may not use this file except in compliance with the License. You 6 | * may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 13 | * implied. See the License for the specific language governing 14 | * permissions and limitations under the License. See accompanying 15 | * LICENSE file. 16 | */ 17 | package com.yahoo.ycsb.db; 18 | 19 | /** 20 | * Constants used by the JDBC client. 21 | * 22 | * @author sudipto 23 | * 24 | */ 25 | public interface JdbcDBClientConstants { 26 | 27 | /** The class to use as the jdbc driver. */ 28 | public static final String DRIVER_CLASS = "db.driver"; 29 | 30 | /** The URL to connect to the database. */ 31 | public static final String CONNECTION_URL = "db.url"; 32 | 33 | /** The user name to use to connect to the database. */ 34 | public static final String CONNECTION_USER = "db.user"; 35 | 36 | /** The password to use for establishing the connection. */ 37 | public static final String CONNECTION_PASSWD = "db.passwd"; 38 | 39 | /** The JDBC fetch size hinted to the driver. */ 40 | public static final String JDBC_FETCH_SIZE = "jdbc.fetchsize"; 41 | 42 | /** The JDBC connection auto-commit property for the driver. */ 43 | public static final String JDBC_AUTO_COMMIT = "jdbc.autocommit"; 44 | 45 | /** The name of the property for the number of fields in a record. */ 46 | public static final String FIELD_COUNT_PROPERTY = "fieldcount"; 47 | 48 | /** Default number of fields in a record. */ 49 | public static final String FIELD_COUNT_PROPERTY_DEFAULT = "10"; 50 | 51 | /** Representing a NULL value. */ 52 | public static final String NULL_VALUE = "NULL"; 53 | 54 | /** The code to return when the call succeeds. */ 55 | public static final int SUCCESS = 0; 56 | 57 | /** The Timestamp key in the user table.*/ 58 | public static String TIMESTAMP_KEY = "YCSB_KEY"; 59 | } 60 | -------------------------------------------------------------------------------- /jdbc/src/main/resources/sql/README: -------------------------------------------------------------------------------- 1 | Contains all the SQL statements used by the JDBC client. 2 | -------------------------------------------------------------------------------- /jdbc/src/main/resources/sql/create_table.monetdb: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2015 YCSB contributors. All rights reserved. 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); you 4 | -- may not use this file except in compliance with the License. You 5 | -- may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | -- implied. See the License for the specific language governing 13 | -- permissions and limitations under the License. See accompanying 14 | -- LICENSE file. 15 | 16 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 17 | CREATE TABLE test.usermetric( 18 | ID INT AUTO_INCREMENT PRIMARY KEY, 19 | YCSB_KEY TIMESTAMP, 20 | VALUE DOUBLE, 21 | TAG0 TEXT, TAG1 TEXT, 22 | TAG2 TEXT, TAG3 TEXT, 23 | TAG4 TEXT, TAG5 TEXT, 24 | TAG6 TEXT, TAG7 TEXT, 25 | TAG8 TEXT, TAG9 TEXT); 26 | -------------------------------------------------------------------------------- /jdbc/src/main/resources/sql/create_table.mysql: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2015 YCSB contributors. All rights reserved. 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); you 4 | -- may not use this file except in compliance with the License. You 5 | -- may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | -- implied. See the License for the specific language governing 13 | -- permissions and limitations under the License. See accompanying 14 | -- LICENSE file. 15 | 16 | -- Creates a Table. 17 | -- see https://github.com/brianfrankcooper/YCSB/blob/master/jdbc/src/main/resources/sql/create_table.mysql 18 | 19 | -- Drop the table if it exists; 20 | DROP TABLE IF EXISTS test.usermetric; 21 | 22 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 23 | CREATE TABLE test.usermetric( 24 | ID INT AUTO_INCREMENT PRIMARY KEY, 25 | YCSB_KEY TIMESTAMP, 26 | VALUE DOUBLE, 27 | TAG0 TEXT, TAG1 TEXT, 28 | TAG2 TEXT, TAG3 TEXT, 29 | TAG4 TEXT, TAG5 TEXT, 30 | TAG6 TEXT, TAG7 TEXT, 31 | TAG8 TEXT, TAG9 TEXT); 32 | -------------------------------------------------------------------------------- /jdbc/src/main/resources/sql/create_table.psql: -------------------------------------------------------------------------------- 1 | -- Creates a Table. 2 | 3 | -- Drop the table if it exists; 4 | DROP TABLE IF EXISTS usermetric; 5 | 6 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 7 | CREATE TABLE usermetric( 8 | ID SERIAL PRIMARY KEY, 9 | YCSB_KEY TIMESTAMP, 10 | VALUE DOUBLE PRECISION, 11 | TAG0 TEXT, TAG1 TEXT, 12 | TAG2 TEXT, TAG3 TEXT, 13 | TAG4 TEXT, TAG5 TEXT, 14 | TAG6 TEXT, TAG7 TEXT, 15 | TAG8 TEXT, TAG9 TEXT); 16 | -------------------------------------------------------------------------------- /jdbc/src/main/resources/sql/create_table.sql: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2015 YCSB contributors. All rights reserved. 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); you 4 | -- may not use this file except in compliance with the License. You 5 | -- may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | -- implied. See the License for the specific language governing 13 | -- permissions and limitations under the License. See accompanying 14 | -- LICENSE file. 15 | 16 | -- Creates a Table. 17 | 18 | -- Drop the table if it exists; 19 | DROP TABLE IF EXISTS usermetric; 20 | 21 | -- Create the usermetric table with 10 fields and 1 double value and Timestamp as key 22 | CREATE TABLE usermetric( 23 | ID INT IDENTITY(1,1) PRIMARY KEY, 24 | YCSB_KEY TIMESTAMP, 25 | VALUE DOUBLE PRECISION, 26 | TAG0 VARCHAR, TAG1 VARCHAR, 27 | TAG2 VARCHAR, TAG3 VARCHAR, 28 | TAG4 VARCHAR, TAG5 VARCHAR, 29 | TAG6 VARCHAR, TAG7 VARCHAR, 30 | TAG8 VARCHAR, TAG9 VARCHAR); 31 | -------------------------------------------------------------------------------- /kairosdb/kairosdb-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /kairosdb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | kairosdb-binding 13 | KairosDB Binding 14 | jar 15 | 16 | 17 | 18 | org.kairosdb 19 | client 20 | 2.0 21 | 22 | 23 | com.yahoo.ycsb 24 | core 25 | ${project.version} 26 | provided 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /kairosdb/src/main/java/com/yahoo/.directory: -------------------------------------------------------------------------------- 1 | [Dolphin] 2 | PreviewsShown=true 3 | SortOrder=1 4 | Timestamp=2015,8,3,14,57,54 5 | Version=3 6 | ViewMode=1 7 | -------------------------------------------------------------------------------- /kdbplus-java/kdbplus-java.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /kdbplus-java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.yahoo.ycsb 5 | binding-parent 6 | 0.4.0 7 | ../binding-parent 8 | 9 | 10 | kdbplus-java 11 | 2015-08-13 12 | kdb+ Java API 13 | 14 | 15 | -------------------------------------------------------------------------------- /kdbplus/kdbplus-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /kdbplus/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.yahoo.ycsb 6 | binding-parent 7 | 0.4.0 8 | ../binding-parent 9 | 10 | kdbplus-binding 11 | kdb+ Binding 12 | 13 | 14 | 15 | com.yahoo.ycsb 16 | core 17 | ${project.version} 18 | provided 19 | 20 | 21 | com.yahoo.ycsb 22 | kdbplus-java 23 | 2015-08-13 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /newts/newts-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /newts/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | newts-binding 13 | NewTS Binding 14 | jar 15 | 16 | 17 | org.opennms.newts 18 | newts-cassandra 19 | 1.3.1 20 | 21 | 22 | org.opennms.newts 23 | newts-cassandra-search 24 | 1.3.1 25 | 26 | 27 | com.yahoo.ycsb 28 | core 29 | ${project.version} 30 | provided 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /opentsdb/opentsdb-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /opentsdb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | opentsdb-binding 13 | OpenTSDB Binding 14 | jar 15 | 16 | 17 | 18 | org.json 19 | json 20 | 20140107 21 | 22 | 23 | org.apache.httpcomponents 24 | httpclient 25 | 4.5 26 | 27 | 28 | com.yahoo.ycsb 29 | core 30 | ${project.version} 31 | provided 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /prometheus/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | prometheus-binding 13 | Prometheus Binding 14 | jar 15 | 16 | 17 | 18 | org.json 19 | json 20 | 20140107 21 | 22 | 23 | org.apache.httpcomponents 24 | httpclient 25 | 4.5 26 | 27 | 28 | 29 | io.prometheus 30 | simpleclient 31 | 0.0.19 32 | 33 | 34 | 35 | io.prometheus 36 | simpleclient_hotspot 37 | 0.0.19 38 | 39 | 40 | 41 | io.prometheus 42 | simpleclient_servlet 43 | 0.0.19 44 | 45 | 46 | 47 | io.prometheus 48 | simpleclient_pushgateway 49 | 0.0.19 50 | 51 | 52 | com.yahoo.ycsb 53 | core 54 | ${project.version} 55 | provided 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /prometheus/prometheus-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | -------------------------------------------------------------------------------- /rhombus/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.yahoo.ycsb 7 | binding-parent 8 | 0.4.0 9 | ../binding-parent 10 | 11 | 12 | 13 | sonatype-nexus-snapshots 14 | https://oss.sonatype.org/content/repositories/snapshots 15 | false 16 | true 17 | 18 | 19 | rhombus-binding 20 | Rhombus Binding 21 | jar 22 | 23 | 24 | com.pardot 25 | rhombus 26 | 2.0.12-SNAPSHOT 27 | 28 | 29 | org.slf4j 30 | slf4j-api 31 | 1.7.4 32 | 33 | 34 | ch.qos.logback 35 | logback-core 36 | 1.0.10 37 | 38 | 39 | com.yahoo.ycsb 40 | core 41 | ${project.version} 42 | provided 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /root.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /seriesly/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.yahoo.ycsb 5 | binding-parent 6 | 0.4.0 7 | ../binding-parent 8 | 9 | seriesly-binding 10 | 11 | 12 | com.yahoo.ycsb 13 | core 14 | ${project.version} 15 | provided 16 | 17 | 18 | org.apache.httpcomponents 19 | httpclient 20 | 4.5.1 21 | 22 | 23 | org.json 24 | json 25 | 20151123 26 | 27 | 28 | Seriesly-Binding 29 | 30 | -------------------------------------------------------------------------------- /seriesly/seriesly-binding.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /seriesly/src/main/java/com/yahoo/ycsb/db/Test.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.ycsb.db; 2 | 3 | import java.sql.Timestamp; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | import com.yahoo.ycsb.DBException; 7 | 8 | public class Test { 9 | 10 | public static void main(String[] args) throws DBException { 11 | 12 | SerieslyClient serieslyClient = new SerieslyClient(); 13 | serieslyClient.init(); 14 | 15 | System.out.println("insert:"); 16 | System.out.println("sould be 0: " 17 | + serieslyClient.insert("metric1", Timestamp.valueOf("2010-01-01 12:23:42.343434"), 1.0, null)); 18 | System.out.println("sould be 0: " 19 | + serieslyClient.insert("metric1", Timestamp.valueOf("2010-01-01 12:23:43.343434"), 2.0, null)); 20 | System.out.println("sould be 0: " 21 | + serieslyClient.insert("metric1", Timestamp.valueOf("2010-01-01 12:23:44.343434"), 3.0, null)); 22 | 23 | System.out.println("read:"); 24 | System.out.println( 25 | "sould be 0: " + serieslyClient.read("metric1", Timestamp.valueOf("2010-01-01 12:23:42.343434"), null)); 26 | System.out.println("souldn't be 0: " 27 | + serieslyClient.read("metric1", Timestamp.valueOf("2011-11-11 12:23:42.343434"), null)); 28 | 29 | System.out.println("scan:"); 30 | System.out.println( 31 | "sould be 0: " + serieslyClient.scan("metric1", Timestamp.valueOf("2010-01-01 12:23:42.343434"), 32 | Timestamp.valueOf("2010-01-01 12:23:44.343434"), null, true, false, false, 1, TimeUnit.HOURS)); 33 | System.out.println( 34 | "sould be 0: " + serieslyClient.scan("metric1", Timestamp.valueOf("2010-01-01 12:23:42.343434"), 35 | Timestamp.valueOf("2010-01-01 12:23:44.343434"), null, false, true, false, 1, TimeUnit.HOURS)); 36 | System.out.println( 37 | "sould be 0: " + serieslyClient.scan("metric1", Timestamp.valueOf("2010-01-01 12:23:42.343434"), 38 | Timestamp.valueOf("2010-01-01 12:23:44.343434"), null, false, false, true, 1, TimeUnit.HOURS)); 39 | System.out.println( 40 | "sould be 0: " + serieslyClient.scan("metric1", Timestamp.valueOf("2010-01-01 12:23:42.343434"), 41 | Timestamp.valueOf("2010-01-01 12:23:44.343434"), null, false, false, false, 1, TimeUnit.HOURS)); 42 | System.out.println( 43 | "souldn't be 0: " + serieslyClient.scan("metric1", Timestamp.valueOf("2011-11-11 12:23:42.343434"), 44 | Timestamp.valueOf("2011-11-11 12:23:44.343434"), null, false, false, false, 1, TimeUnit.HOURS)); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /workloads/testworkloada: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 Yahoo! Inc. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you 4 | # may not use this file except in compliance with the License. You 5 | # may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. See the License for the specific language governing 13 | # permissions and limitations under the License. See accompanying 14 | # LICENSE file. 15 | 16 | 17 | # Yahoo! Cloud System Benchmark 18 | # Workload A: Update heavy workload 19 | # Application example: Session store recording recent actions 20 | # 21 | # Read/update ratio: 50/50 22 | # Default data size: 1 KB records (10 fields, 100 bytes each, plus key) 23 | # Request distribution: zipfian 24 | 25 | workload=com.yahoo.ycsb.workloads.CoreWorkload 26 | recordcount=1000 27 | operationcount=1000 28 | insertstart=1439241005000 29 | insertend=1439242005000 30 | measurementtype=histogram 31 | tagvaluelength=10 32 | tagprefix=TAG 33 | tagcount=3 34 | randomtagamount=false 35 | predefinedtagvalues=true 36 | predefinedtagvalueamount=100 37 | predefinedtagstoragefile=predefinedtags.txt 38 | valuemax=10000 39 | valuemin=0 40 | readproportion=1 41 | insertproportion=0 42 | scanproportion=0 43 | avgproportion=0 44 | countproportion=0 45 | sumproportion=0 46 | timevalue=0 47 | timeunit=s 48 | requestdistribution=uniform 49 | maxscanlength=1000 50 | minscanlength=500 51 | scanlengthdistribution=uniform 52 | maxrecordsperts=10 53 | randomamountperts=constant 54 | randomfloorfilling=false 55 | querymaxtagvalues=1 56 | notagsforread=true 57 | readfromcsv=false 58 | csvfile=values.csv 59 | csvbuffersize=100000 60 | description=Workloaddescription 61 | timeresolution=1000 62 | -------------------------------------------------------------------------------- /workloads/testworkloadb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 Yahoo! Inc. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you 4 | # may not use this file except in compliance with the License. You 5 | # may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. See the License for the specific language governing 13 | # permissions and limitations under the License. See accompanying 14 | # LICENSE file. 15 | 16 | 17 | # Yahoo! Cloud System Benchmark 18 | # Workload A: Update heavy workload 19 | # Application example: Session store recording recent actions 20 | # 21 | # Read/update ratio: 50/50 22 | # Default data size: 1 KB records (10 fields, 100 bytes each, plus key) 23 | # Request distribution: zipfian 24 | 25 | workload=com.yahoo.ycsb.workloads.CoreWorkload 26 | recordcount=1000 27 | operationcount=1000 28 | insertstart=1439241005000 29 | insertend=1439242005000 30 | measurementtype=histogram 31 | tagvaluelength=10 32 | tagprefix=TAG 33 | tagcount=3 34 | randomtagamount=false 35 | predefinedtagvalues=true 36 | predefinedtagvalueamount=100 37 | predefinedtagstoragefile=predefinedtags.txt 38 | valuemax=10000 39 | valuemin=0 40 | readproportion=0 41 | insertproportion=0 42 | scanproportion=0.25 43 | avgproportion=0.25 44 | countproportion=0.25 45 | sumproportion=0.25 46 | timevalue=0 47 | timeunit=s 48 | requestdistribution=uniform 49 | maxscanlength=1000 50 | minscanlength=500 51 | scanlengthdistribution=uniform 52 | maxrecordsperts=10 53 | randomamountperts=constant 54 | randomfloorfilling=false 55 | querymaxtagvalues=5 56 | notagsforread=true 57 | readfromcsv=false 58 | csvfile=values.csv 59 | csvbuffersize=100000 60 | description=Workloaddescription 61 | timeresolution=1000 -------------------------------------------------------------------------------- /workloads/workloada: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 Yahoo! Inc. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you 4 | # may not use this file except in compliance with the License. You 5 | # may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. See the License for the specific language governing 13 | # permissions and limitations under the License. See accompanying 14 | # LICENSE file. 15 | 16 | 17 | # Yahoo! Cloud System Benchmark 18 | # Workload A: Update heavy workload 19 | # Application example: Session store recording recent actions 20 | # 21 | # Read/update ratio: 50/50 22 | # Default data size: 1 KB records (10 fields, 100 bytes each, plus key) 23 | # Request distribution: zipfian 24 | 25 | workload=com.yahoo.ycsb.workloads.CoreWorkload 26 | recordcount=1000000 27 | operationcount=1000 28 | insertstart=1439241005000 29 | insertend=1440241005000 30 | measurementtype=histogram 31 | metric=usermetric 32 | tagcount=3 33 | tagvaluelengthdistribution=constant 34 | tagvaluelength=10 35 | tagprefix=TAG 36 | randomtagamount=false 37 | predefinedtagvalues=true 38 | predefinedtagvalueamount=1000 39 | predefinedtagstoragefile=predefinedtags.txt 40 | predefinedtagstoreused=true 41 | valuemax=10000 42 | valuemin=0 43 | readproportion=1 44 | insertproportion=0 45 | scanproportion=0 46 | avgproportion=0 47 | countproportion=0 48 | sumproportion=0 49 | timevalue=0 50 | timeunit=ms 51 | requestdistribution=uniform 52 | maxscanlength=1000 53 | minscanlength=500 54 | scanlengthdistribution=uniform 55 | maxrecordsperts=10 56 | randomamountperts=constant 57 | randomfloorfilling=false 58 | querymaxtagvalues=1 59 | notagsforread=true 60 | readfromcsv=false 61 | csvfile=values.csv 62 | csvbuffersize=100000 63 | description=Inserts 1000000 records with 3 tags each. Earch tag has a value with a length of 10. Each record has a double value between 0 and 10000. After all inserts has processed there will be 1000 (random) read operations. Read will only use timestamp, no tags. All data will use 10000 predefined, randomly generated, tags. There is only one record per timestamp. 64 | timeresolution=1000 -------------------------------------------------------------------------------- /workloads/workloadb: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010 Yahoo! Inc. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you 4 | # may not use this file except in compliance with the License. You 5 | # may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. See the License for the specific language governing 13 | # permissions and limitations under the License. See accompanying 14 | # LICENSE file. 15 | 16 | 17 | # Yahoo! Cloud System Benchmark 18 | # Workload A: Update heavy workload 19 | # Application example: Session store recording recent actions 20 | # 21 | # Read/update ratio: 50/50 22 | # Default data size: 1 KB records (10 fields, 100 bytes each, plus key) 23 | # Request distribution: zipfian 24 | 25 | workload=com.yahoo.ycsb.workloads.CoreWorkload 26 | recordcount=1000000 27 | operationcount=1000 28 | insertstart=1439241005000 29 | insertend=1440241005000 30 | measurementtype=histogram 31 | metric=usermetric 32 | tagcount=3 33 | tagvaluelengthdistribution=constant 34 | tagvaluelength=10 35 | tagprefix=TAG 36 | randomtagamount=false 37 | predefinedtagvalues=true 38 | predefinedtagvalueamount=1000 39 | predefinedtagstoragefile=predefinedtags.txt 40 | predefinedtagstoreused=true 41 | valuemax=10000 42 | valuemin=0 43 | readproportion=0 44 | insertproportion=0 45 | scanproportion=0.25 46 | avgproportion=0.25 47 | countproportion=0.25 48 | sumproportion=0.25 49 | timevalue=0 50 | timeunit=ms 51 | requestdistribution=uniform 52 | maxscanlength=10000 53 | minscanlength=1000 54 | scanlengthdistribution=uniform 55 | maxrecordsperts=10 56 | randomamountperts=constant 57 | randomfloorfilling=false 58 | querymaxtagvalues=5 59 | notagsforread=true 60 | readfromcsv=false 61 | csvfile=values.csv 62 | csvbuffersize=100000 63 | description=Inserts 1000000 records with 3 tags each. Earch tag has a value with a length of 10. Each record has a double value between 0 and 10000. After all inserts has processed there will be 100 sum/count/avg/scan operations (25 each) on a random timespan (min 1000 s, max 10000 s) with a random amount (between 1-5) of tagvalues per tag. All data will use 10000 predefined, randomly generated, tags. There is only one record per timestamp. 64 | timeresolution=1000 65 | --------------------------------------------------------------------------------