zoukankan      html  css  js  c++  java
  • LevelDB Filters

    LevelDB Filters

      Because of the way leveldb data is organized on disk, a single Get() call may involve multiple reads from disk. The optional FilterPolicy mechanism can be used to reduce the number of disk reads substantially.

       leveldb::Options options;
       options.filter_policy = NewBloomFilterPolicy(10);
       leveldb::DB* db;
       leveldb::DB::Open(options, "/tmp/testdb", &db);
       ... use the database ...
       delete db;
       delete options.filter_policy;
    

      The preceding code associates a Bloom filter based filtering policy with the database. Bloom filter based filtering relies on keeping some number of bits of data in memory per key (in this case 10 bits per key since that is the argument we passed to NewBloomFilterPolicy). This filter will reduce the number of unnecessary disk reads needed for Get() calls by a factor of approximately a 100. Increasing the bits per key will lead to a larger reduction at the cost of more memory usage.

      We recommend that applications whose working set does not fit in memory and that do a lot of random reads set a filter policy.

  • 相关阅读:
    Java 抽象类
    Java final 关键字
    Java 异常机制
    hashcode和equals
    DevExpress 柱状图
    Windows X64平台搭建Java开发环境
    J2EE 学习路线
    winform 客户端采用HTTP协议与服务端通信
    C# 处理Json
    性能分析工具 DotTrance
  • 原文地址:https://www.cnblogs.com/tekkaman/p/4873949.html
Copyright © 2011-2022 走看看