1. 17 8月, 2016 1 次提交
  2. 13 8月, 2016 1 次提交
    • A
      add Name() to Cache · e408e98c
      Aaron Gao 提交于
      Summary: preparation for detecting Cache type. If SimCache, we then may trigger some command like "setSimCapacity()" with setOptions()
      
      Test Plan: make all check
      
      Reviewers: yiwu, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D61953
      e408e98c
  3. 16 7月, 2016 1 次提交
    • Y
      Refactor cache.cc · 4b952535
      Yi Wu 提交于
      Summary: Refactor cache.cc so that I can plugin clock cache (D55581). Mainly move `ShardedCache` to separate file, move `LRUHandle` back to cache.cc and rename it lru_cache.cc.
      
      Test Plan:
          make check -j64
      
      Reviewers: lightmark, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D59655
      4b952535
  4. 24 5月, 2016 1 次提交
    • A
      add simulator Cache as class SimCache/SimLRUCache(with test) · 5d660258
      Aaron Gao 提交于
      Summary: add class SimCache(base class with instrumentation api) and SimLRUCache(derived class with detailed implementation) which is used as an instrumented block cache that can predict hit rate for different cache size
      
      Test Plan:
      Add a test case in `db_block_cache_test.cc` called `SimCacheTest` to test basic logic of SimCache.
      Also add option `-simcache_size` in db_bench. if set with a value other than -1, then the benchmark will use this value as the size of the simulator cache and finally output the simulation result.
      ```
      [gzh@dev9927.prn1 ~/local/rocksdb] ./db_bench -benchmarks "fillseq,readrandom" -cache_size 1000000 -simcache_size 1000000
      RocksDB:    version 4.8
      Date:       Tue May 17 16:56:16 2016
      CPU:        32 * Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
      CPUCache:   20480 KB
      Keys:       16 bytes each
      Values:     100 bytes each (50 bytes after compression)
      Entries:    1000000
      Prefix:    0 bytes
      Keys per prefix:    0
      RawSize:    110.6 MB (estimated)
      FileSize:   62.9 MB (estimated)
      Write rate: 0 bytes/second
      Compression: Snappy
      Memtablerep: skip_list
      Perf Level: 0
      WARNING: Assertions are enabled; benchmarks unnecessarily slow
      ------------------------------------------------
      DB path: [/tmp/rocksdbtest-112628/dbbench]
      fillseq      :       6.809 micros/op 146874 ops/sec;   16.2 MB/s
      DB path: [/tmp/rocksdbtest-112628/dbbench]
      readrandom   :       6.343 micros/op 157665 ops/sec;   17.4 MB/s (1000000 of 1000000 found)
      
      SIMULATOR CACHE STATISTICS:
      SimCache LOOKUPs: 986559
      SimCache HITs:    264760
      SimCache HITRATE: 26.84%
      
      [gzh@dev9927.prn1 ~/local/rocksdb] ./db_bench -benchmarks "fillseq,readrandom" -cache_size 1000000 -simcache_size 10000000
      RocksDB:    version 4.8
      Date:       Tue May 17 16:57:10 2016
      CPU:        32 * Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
      CPUCache:   20480 KB
      Keys:       16 bytes each
      Values:     100 bytes each (50 bytes after compression)
      Entries:    1000000
      Prefix:    0 bytes
      Keys per prefix:    0
      RawSize:    110.6 MB (estimated)
      FileSize:   62.9 MB (estimated)
      Write rate: 0 bytes/second
      Compression: Snappy
      Memtablerep: skip_list
      Perf Level: 0
      WARNING: Assertions are enabled; benchmarks unnecessarily slow
      ------------------------------------------------
      DB path: [/tmp/rocksdbtest-112628/dbbench]
      fillseq      :       5.066 micros/op 197394 ops/sec;   21.8 MB/s
      DB path: [/tmp/rocksdbtest-112628/dbbench]
      readrandom   :       6.457 micros/op 154870 ops/sec;   17.1 MB/s (1000000 of 1000000 found)
      
      SIMULATOR CACHE STATISTICS:
      SimCache LOOKUPs: 1059764
      SimCache HITs:    374501
      SimCache HITRATE: 35.34%
      
      [gzh@dev9927.prn1 ~/local/rocksdb] ./db_bench -benchmarks "fillseq,readrandom" -cache_size 1000000 -simcache_size 100000000
      RocksDB:    version 4.8
      Date:       Tue May 17 16:57:32 2016
      CPU:        32 * Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
      CPUCache:   20480 KB
      Keys:       16 bytes each
      Values:     100 bytes each (50 bytes after compression)
      Entries:    1000000
      Prefix:    0 bytes
      Keys per prefix:    0
      RawSize:    110.6 MB (estimated)
      FileSize:   62.9 MB (estimated)
      Write rate: 0 bytes/second
      Compression: Snappy
      Memtablerep: skip_list
      Perf Level: 0
      WARNING: Assertions are enabled; benchmarks unnecessarily slow
      ------------------------------------------------
      DB path: [/tmp/rocksdbtest-112628/dbbench]
      fillseq      :       5.632 micros/op 177572 ops/sec;   19.6 MB/s
      DB path: [/tmp/rocksdbtest-112628/dbbench]
      readrandom   :       6.892 micros/op 145094 ops/sec;   16.1 MB/s (1000000 of 1000000 found)
      
      SIMULATOR CACHE STATISTICS:
      SimCache LOOKUPs: 1150767
      SimCache HITs:    1034535
      SimCache HITRATE: 89.90%
      ```
      
      Reviewers: IslamAbdelRahman, andrewkr, sdong
      
      Reviewed By: sdong
      
      Subscribers: MarkCallaghan, andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D57999
      5d660258
  5. 08 4月, 2016 1 次提交
  6. 02 4月, 2016 1 次提交
    • M
      Adding pin_l0_filter_and_index_blocks_in_cache feature and related fixes. · 9b519875
      Marton Trencseni 提交于
      Summary:
      When a block based table file is opened, if prefetch_index_and_filter is true, it will prefetch the index and filter blocks, putting them into the block cache.
      What this feature adds: when a L0 block based table file is opened, if pin_l0_filter_and_index_blocks_in_cache is true in the options (and prefetch_index_and_filter is true), then the filter and index blocks aren't released back to the block cache at the end of BlockBasedTableReader::Open(). Instead the table reader takes ownership of them, hence pinning them, ie. the LRU cache will never push them out. Meanwhile in the table reader, further accesses will not hit the block cache, thus avoiding lock contention.
      
      Test Plan:
      'export TEST_TMPDIR=/dev/shm/ && DISABLE_JEMALLOC=1 OPT=-g make all valgrind_check -j32' is OK.
      I didn't run the Java tests, I don't have Java set up on my devserver.
      
      Reviewers: sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba
      
      Differential Revision: https://reviews.facebook.net/D56133
      9b519875
  7. 11 3月, 2016 1 次提交
    • Y
      Cache to have an option to fail Cache::Insert() when full · f71fc77b
      Yi Wu 提交于
      Summary:
      Cache to have an option to fail Cache::Insert() when full. Update call sites to check status and handle error.
      
      I totally have no idea what's correct behavior of all the call sites when they encounter error. Please let me know if you see something wrong or more unit test is needed.
      
      Test Plan: make check -j32, see tests pass.
      
      Reviewers: anthony, yhchiang, andrewkr, IslamAbdelRahman, kradhakrishnan, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D54705
      f71fc77b
  8. 10 2月, 2016 1 次提交
  9. 05 12月, 2015 1 次提交
  10. 08 10月, 2015 1 次提交
  11. 19 6月, 2015 1 次提交
    • A
      Add Cache.GetPinnedUsageUsage() · 69bb210d
      Aaron Feldman 提交于
      Summary:
        Add the funcion Cache.GetPinnedUsage() to return the memory size of entries
        that are in use by the system (that is, all the entries not in the LRU list).
      
      Test Plan:
        Run ./cache_test and examine PinnedUsageTest.
      
      Reviewers: tnovak, igor
      
      Reviewed By: igor
      
      Subscribers: dhruba
      
      Differential Revision: https://reviews.facebook.net/D40305
      69bb210d
  12. 25 4月, 2015 2 次提交
  13. 18 3月, 2015 1 次提交
  14. 27 2月, 2015 1 次提交
    • I
      rocksdb: Add missing override · 62247ffa
      Igor Sugak 提交于
      Summary:
      When using latest clang (3.6 or 3.7/trunck) rocksdb is failing with many errors. Almost all of them are missing override errors. This diff adds missing override keyword. No manual changes.
      
      Prerequisites: bear and clang 3.5 build with extra tools
      
      ```lang=bash
      % USE_CLANG=1 bear make all # generate a compilation database http://clang.llvm.org/docs/JSONCompilationDatabase.html
      % clang-modernize -p . -include . -add-override
      % make format
      ```
      
      Test Plan:
      Make sure all tests are passing.
      ```lang=bash
      % #Use default fb code clang.
      % make check
      ```
      Verify less error and no missing override errors.
      ```lang=bash
      % # Have trunk clang present in path.
      % ROCKSDB_NO_FBCODE=1 CC=clang CXX=clang++ make
      ```
      
      Reviewers: igor, kradhakrishnan, rven, meyering, sdong
      
      Reviewed By: sdong
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D34077
      62247ffa
  15. 11 12月, 2014 1 次提交
    • A
      Modifed the LRU cache eviction code so that it doesn't evict blocks which have exteranl references · ee95cae9
      Alexey Maykov 提交于
      Summary:
      Currently, blocks which have more than one reference (ie referenced by something other than cache itself) are evicted from cache. This doesn't make much sense:
      - blocks are still in RAM, so the RAM usage reported by the cache is incorrect
      - if the same block is needed by another iterator, it will be loaded and decompressed again
      
      This diff changes the reference counting scheme a bit. Previously, if the cache contained the block, this was accounted for in its refcount. After this change, the refcount is only used to track external references. There is a boolean flag which indicates whether or not the block is contained in the cache.
      This diff also changes how LRU list is used. Previously, both hashtable and the LRU list contained all blocks. After this change, the LRU list contains blocks with the refcount==0, ie those which can be evicted from the cache.
      
      Note that this change still allows for cache to grow beyond its capacity. This happens when all blocks are pinned (ie refcount>0). This is consistent with the current behavior. The cache's insert function never fails. I spent lots of time trying to make table_reader and other places work with the insert which might failed. It turned out to be pretty hard. It might really destabilize some customers, so finally, I decided against doing this.
      
      table_cache_remove_scan_count_limit option will be unneeded after this change, but I will remove it in the following diff, if this one gets approved
      
      Test Plan: Ran tests, made sure they pass
      
      Reviewers: sdong, ljin
      
      Differential Revision: https://reviews.facebook.net/D25503
      ee95cae9
  16. 12 11月, 2014 1 次提交
    • I
      Turn on -Wshorten-64-to-32 and fix all the errors · 767777c2
      Igor Canadi 提交于
      Summary:
      We need to turn on -Wshorten-64-to-32 for mobile. See D1671432 (internal phabricator) for details.
      
      This diff turns on the warning flag and fixes all the errors. There were also some interesting errors that I might call bugs, especially in plain table. Going forward, I think it makes sense to have this flag turned on and be very very careful when converting 64-bit to 32-bit variables.
      
      Test Plan: compiles
      
      Reviewers: ljin, rven, yhchiang, sdong
      
      Reviewed By: yhchiang
      
      Subscribers: bobbaldwin, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D28689
      767777c2
  17. 01 11月, 2014 1 次提交
    • I
      Turn on -Wshadow · 9f7fc3ac
      Igor Canadi 提交于
      Summary:
      ...and fix all the errors :)
      
      Jim suggested turning on -Wshadow because it helped him fix number of critical bugs in fbcode. I think it's a good idea to be -Wshadow clean.
      
      Test Plan: compiles
      
      Reviewers: yhchiang, rven, sdong, ljin
      
      Reviewed By: ljin
      
      Subscribers: dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D27711
      9f7fc3ac
  18. 03 5月, 2014 1 次提交
  19. 25 1月, 2014 1 次提交
    • I
      Add a call DisownData() to Cache, which should speed up shutdown · b13bdfa5
      Igor Canadi 提交于
      Summary: On a shutdown, freeing memory takes a long time. If we're shutting down, we don't really care about memory leaks. I added a call to Cache that will avoid freeing all objects in cache.
      
      Test Plan:
      I created a script to test the speedup and demonstrate how to use the call: https://phabricator.fb.com/P3864368
      
      Clean shutdown took 7.2 seconds, while fast and dirty one took 6.3 seconds. Unfortunately, the speedup is not that big, but should be bigger with bigger block_cache. I have set up the capacity to 80GB, but the script filled up only ~7GB.
      
      Reviewers: dhruba, haobo, MarkCallaghan, xjin
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D15069
      b13bdfa5
  20. 03 1月, 2014 1 次提交
    • K
      Replace vector with autovector · 774ed89c
      Kai Liu 提交于
      Summary: this diff only replace the cases when we need to frequently create vector with small amount of entries. This diff doesn't aim to improve performance of a specific area, but more like a small scale test for the autovector and see how it works in real life.
      
      Test Plan:
      make check
      
      I also ran the performance tests, however there is no performance gain/loss. All performance numbers are pretty much the same before/after the change.
      
      Reviewers: dhruba, haobo, sdong, igor
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D14985
      774ed89c
  21. 14 12月, 2013 2 次提交
    • K
      Revert `atomic_size_t usage` · 5f5e5fc2
      kailiu 提交于
      Summary:
      By disassemble the function, we found that the atomic variables do invoke the `lock` that locks the memory bus.
      As a tradeoff, we protect the GetUsage by mutex and leave usage_ as plain size_t.
      
      Test Plan: passed `cache_test`
      
      Reviewers: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D14667
      5f5e5fc2
    • K
      Expose usage info for the cache · b660e2d4
      kailiu 提交于
      Summary: This diff will help us to figure out the memory usage for the cache part.
      
      Test Plan: added a new memory usage test for cache
      
      Reviewers: haobo, sdong, dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D14559
      b660e2d4
  22. 12 12月, 2013 1 次提交
    • I
      [RocksDB perf] Cache speedup · e8d40c31
      Igor Canadi 提交于
      Summary:
      I have ran a get benchmark where all the data is in the cache and observed that most of the time is spent on waiting for lock in LRUCache.
      
      This is an effort to optimize LRUCache.
      
      Test Plan:
      The data was loaded with fillseq. Then, I ran a benchmark:
      
          /db_bench --db=/tmp/rocksdb_stat_bench --num=1000000 --benchmarks=readrandom --statistics=1 --use_existing_db=1 --threads=16 --disable_seek_compaction=1 --cache_size=20000000000 --cache_numshardbits=8 --table_cache_numshardbits=8
      
      I ran the benchmark three times. Here are the results:
      AFTER THE PATCH: 798072, 803998, 811807
      BEFORE THE PATCH: 782008, 815593, 763017
      
      Reviewers: dhruba, haobo, kailiu
      
      Reviewed By: haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D14571
      e8d40c31
  23. 11 12月, 2013 1 次提交
    • K
      Make Cache::GetCapacity constant · c79e5954
      kailiu 提交于
      Summary: This will allow us to access constant via `DB::GetOptions().table_cache.GetCapacity()` or `DB::GetOptions().block_cache.GetCapacity()` since GetOptions() is also constant method.
      c79e5954
  24. 13 11月, 2013 1 次提交
    • K
      Fixing the warning messages captured under mac os # Consider using `git commit... · 21587760
      kailiu 提交于
      Fixing the warning messages captured under mac os # Consider using `git commit -m 'One line title' && arc diff`. # You will save time by running lint and unit in the background.
      
      Summary: The work to make sure mac os compiles rocksdb is not completed yet. But at least we can start cleaning some warnings captured only by g++ from mac os..
      
      Test Plan: ran make in mac os
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D14049
      21587760
  25. 17 10月, 2013 1 次提交
  26. 12 10月, 2013 1 次提交
    • S
      LRUCache to try to clean entries not referenced first. · f8509653
      sdong 提交于
      Summary:
      With this patch, when LRUCache.Insert() is called and the cache is full, it will first try to free up entries whose reference counter is 1 (would become 0 after remo\
      ving from the cache). We do it in two passes, in the first pass, we only try to release those unreferenced entries. If we cannot free enough space after traversing t\
      he first remove_scan_cnt_ entries, we start from the beginning again and remove those entries being used.
      
      Test Plan: add two unit tests to cover the codes
      
      Reviewers: dhruba, haobo, emayanke
      
      Reviewed By: emayanke
      
      CC: leveldb, emayanke, xjin
      
      Differential Revision: https://reviews.facebook.net/D13377
      f8509653
  27. 08 10月, 2013 1 次提交
  28. 05 10月, 2013 1 次提交
  29. 16 9月, 2013 2 次提交
  30. 24 8月, 2013 1 次提交
  31. 05 4月, 2013 1 次提交
  32. 01 3月, 2013 1 次提交
  33. 24 1月, 2013 1 次提交
    • C
      Fix a number of object lifetime/ownership issues · 2fdf91a4
      Chip Turner 提交于
      Summary:
      Replace manual memory management with std::unique_ptr in a
      number of places; not exhaustive, but this fixes a few leaks with file
      handles as well as clarifies semantics of the ownership of file handles
      with log classes.
      
      Test Plan: db_stress, make check
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: zshao, leveldb, heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D8043
      2fdf91a4
  34. 09 1月, 2013 1 次提交
    • K
      Fixed memory leak in ShardedLRUCache · 4d339d74
      Kosie van der Merwe 提交于
      Summary: `~ShardedLRUCache()` was empty despite `init()` allocating memory on the heap. Fixed the leak by freeing memory allocated by `init()`.
      
      Test Plan:
      make check
      
      Ran valgrind on db_test before and after patch and saw leaked memory went down
      
      Reviewers: vamsi, dhruba, emayanke, sheki
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D7791
      4d339d74
  35. 07 11月, 2012 1 次提交
  36. 30 9月, 2012 1 次提交
  37. 30 8月, 2012 1 次提交
    • D
      The sharding of the block cache is limited to 2*20 pieces. · e5fe80e4
      Dhruba Borthakur 提交于
      Summary:
      The numbers of shards that the block cache is divided into is
      configurable. However, if the user specifies that he/she wants
      the block cache to be divided into more than 2**20 pieces, then
      the system will rey to allocate a huge array of that size) that
      could fail.
      
      It is better to limit the sharding of the block cache to an
      upper bound. The default sharding is 16 shards (i.e. 2**4)
      and the maximum is now 2 million shards (i.e. 2**20).
      
      Also, fixed a bug with the LRUCache where the numShardBits
      should be a private member of the LRUCache object rather than
      a static variable.
      
      Test Plan:
      run db_bench with --cache_numshardbits=64.
      
      Task ID: #
      
      Blame Rev:
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5013
      e5fe80e4