Nana-nn / YCSB_leveldb_leveldbjni_rocksdb

Benchmark Tools for Leveldb/LeveldbJni/Rocksdb, 其中RocksDB 模块已MR至 Facebook 开源项目

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ByteIterator

从数据库取数据,我使用了ByteIterator数据接口,其例子和好处如下。

代码示例:

  @Override
  public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) {
    try {
      byte[] value = db.get(key.getBytes());
      Map<String, ByteIterator> deserialized = deserialize(value);
      result.putAll(deserialized);
    } catch (RocksDBException e) {
      System.out.format("[ERROR] caught the unexpceted exception -- %s\n", e);
      return Status.ERROR;
    }
    return Status.OK;
  }

Why I use ByteIterator here?

a.出于性能考虑,主要考虑字符串的成本、拷贝转码问题,流可能是一个图片(blob形式)

b.byte是字节,可以屏蔽utf8、gbk等编码细节。文本从磁盘拿出来本来是二进制,需要通过编码转化为对应的字符。ByteIterator可以屏蔽不同服务器编码不一样的的问题。

使用Byte来存储数据有什么缺点和优点?

使用Iterator有什么缺点和优点?可以屏蔽细节?

使用ByteIerator来有什么缺点和有点?

Leveldb and Rocksdb modules of YCSB

Build Status

Links

http://wiki.github.com/brianfrankcooper/YCSB/
https://labs.yahoo.com/news/yahoo-cloud-serving-benchmark/ ycsb-users@yahoogroups.com

Getting Started

  1. Download the latest release of YCSB:

    curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.12.0/ycsb-0.12.0.tar.gz
    tar xfvz ycsb-0.12.0.tar.gz
    cd ycsb-0.12.0
  2. Set up a database to benchmark. There is a README file under each binding directory.

  3. Run YCSB command.

    On Linux:

    bin/ycsb.sh load basic -P workloads/workloada
    bin/ycsb.sh run basic -P workloads/workloada

    On Windows:

    bin/ycsb.bat load basic -P workloads\workloada
    bin/ycsb.bat run basic -P workloads\workloada

Running the ycsb command without any argument will print the usage.

See https://github.com/brianfrankcooper/YCSB/wiki/Running-a-Workload for a detailed documentation on how to run a workload.

See https://github.com/brianfrankcooper/YCSB/wiki/Core-Properties for the list of available workload properties.

Building from source

YCSB requires the use of Maven 3; if you use Maven 2, you may see errors such as these.

To build the full distribution, with all database bindings:

mvn clean package

To build a single database binding:

mvn -pl com.yahoo.ycsb:mongodb-binding -am clean package

About

Benchmark Tools for Leveldb/LeveldbJni/Rocksdb, 其中RocksDB 模块已MR至 Facebook 开源项目

License:Apache License 2.0


Languages

Language:Java 97.5%Language:Python 1.1%Language:Shell 0.6%Language:Batchfile 0.5%Language:Lua 0.2%Language:TSQL 0.1%Language:HTML 0.0%