Summary: Introduction of memory limiter for IO Dispatch. Currently, the user has no way of enacting policy with IO dispatcher. One important policy is the ability to restrict the amount of memory a multiscan or set of multiscans is allowed to pin. This PR introduces the max_prefetch_memory_bytes in the IODispatcherOptions, allowing for users to specify bounds on block cache memory usage. There seems to be a minor performance increase however, I have found the scans to be a bit noisy. Each benchmark is run with a stride size of 30000 keys. This was done to ensure we maintain parity with trunk. ``` Configuration: 10 concurrent scans, 1024B values, 5242880 byte SST files Scan sizes: 1024 keys = 1MiB, 2048 keys = 2MiB, 4096 keys = 4MiB per scan | Keys/Scan | Mode | Main (ops/sec) | Main (us/op) | limiter (ops/sec) | limiter (us/op) | Delta ops/sec | |-----------|-------|------------------|------------------|----------------------|--------------------|---------------| | 1024 | sync | 151.6 +/- 8.0 | 6591.14 +/- 343.30 | 170.6 +/- 4.0 | 5855.32 +/- 136.19 | +12.00% | | 1024 | async | 156.4 +/- 24.7 | 6589.64 +/- 1345.73 | 173.8 +/- 2.7 | 5744.51 +/- 91.35 | +11.00% | | 2048 | sync | 77.8 +/- 1.6 | 12785.64 +/- 286.49 | 87.6 +/- 3.4 | 11354.01 +/- 441.71 | +12.00% | | 2048 | async | 85.6 +/- 4.7 | 11658.11 +/- 618.49 | 91.4 +/- 1.2 | 10873.63 +/- 143.49 | +6.00% | | 4096 | sync | 43.2 +/- 1.5 | 22932.27 +/- 730.66 | 43.8 +/- 0.7 | 22563.90 +/- 320.93 | +1.00% | | 4096 | async | 45.4 +/- 0.8 | 21875.64 +/- 357.04 | 46.2 +/- 0.7 | 21416.95 +/- 311.89 | +1.00% | ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/14300 Reviewed By: anand1976 Differential Revision: D92316556 Pulled By: krhancoc fbshipit-source-id: dc0b7958a33b8ef5fa5af82b1c6d960041837fc1
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
//
|
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include "rocksdb/io_dispatcher.h"
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
class IODispatcherImpl : public IODispatcher {
|
|
public:
|
|
IODispatcherImpl();
|
|
explicit IODispatcherImpl(const IODispatcherOptions& options);
|
|
~IODispatcherImpl() override;
|
|
|
|
Status SubmitJob(const std::shared_ptr<IOJob>& job,
|
|
std::shared_ptr<ReadSet>* read_set) override;
|
|
|
|
private:
|
|
struct Impl;
|
|
std::shared_ptr<Impl> impl_;
|
|
};
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|