-
Notifications
You must be signed in to change notification settings - Fork 258
MemLens Database Specific Changes #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
3f963bb
global and local build config with profiling flags.
harish876 804dcd1
integrated basic memory hook for RSS calculation
harish876 b67fa88
edited script to generate callgraph using gprof
harish876 4404af5
enabling level db as default storage engine
harish876 33c16f2
systemd telegraf script to stream prometheus node_exporter data to In…
harish876 7c35fe8
added lmdb storage engine interface and partially implemented.
harish876 ccade23
bootstrapping script to run perf tools
harish876 c625f78
adding process exporter to bootstrapping script
harish876 e1ce45d
Added LRU Cache and Observabiity stats
harish876 676a5d3
Merge pull request #1 from harish876/memory-hooks-integration
harish876 491b254
lry cache controlled using settings
harish876 4adc82f
Merge branch 'apache:master' into master
harish876 7eb9fff
removing lmdb implementation
harish876 d8cbe16
removing unecessary scripts
harish876 71975f2
Resolving comments for build flags and memory leak
harish876 35ed786
resolved error. options.block_cache_ integration still not working
harish876 b9b3363
added UT's for TC's. removed logs from stats and changed lru implemen…
harish876 0d02a14
reverting configs and removing unwanted files
harish876 8348689
removing unwanted tst logs
harish876 0a85b15
refactor: rename GetMetrics to UpdateMetrics and improve cache handli…
harish876 ccb268d
feat: add LevelDB block cache support and corresponding tests.
harish876 4cd5b88
feat: enhance LevelDB block cache with configurable capacity and upda…
harish876 a642ef8
refactor: update transaction summary variable names for consistency
harish876 08203e3
build: optimize compilation flags by adding optimization level
harish876 94d2a72
build: remove debugging flags from kv_service and api_tools builds
harish876 a759dda
build: remove profiling flags from set_random_data binary
harish876 a0a136f
build: remove pyroscope monitoring from kv service startup script
harish876 32b5758
build: include string header in lru_cache implementation
harish876 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| build --cxxopt='-std=c++17' --copt=-O3 --jobs=40 | ||
| build --cxxopt='-std=c++17' --copt=-O3 --jobs=40 | ||
| #build --action_env=PYTHON_BIN_PATH="/usr/bin/python3.10" | ||
| #build --action_env=PYTHON_LIB_PATH="/usr/include/python3.10" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cjcchen marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| #include "chain/storage/leveldb.h" | ||
|
|
||
| #include <glog/logging.h> | ||
| #include <gmock/gmock.h> | ||
| #include <gtest/gtest.h> | ||
|
|
||
| #include <filesystem> | ||
|
|
||
| namespace resdb { | ||
| namespace storage { | ||
| namespace { | ||
|
|
||
| enum class CacheConfig { DISABLED, ENABLED }; | ||
|
|
||
| class TestableResLevelDB : public ResLevelDB { | ||
| public: | ||
| using ResLevelDB::block_cache_; | ||
| using ResLevelDB::global_stats_; | ||
| using ResLevelDB::ResLevelDB; | ||
| }; | ||
|
|
||
| class LevelDBTest : public ::testing::TestWithParam<CacheConfig> { | ||
| protected: | ||
| LevelDBTest() { | ||
| LevelDBInfo config; | ||
| if (GetParam() == CacheConfig::ENABLED) { | ||
| config.set_enable_block_cache(true); | ||
| config.set_block_cache_capacity(1000); | ||
| } else { | ||
| Reset(); | ||
| } | ||
| storage = std::make_unique<TestableResLevelDB>(config); | ||
| } | ||
|
|
||
| protected: | ||
| std::unique_ptr<TestableResLevelDB> storage; | ||
| std::string path_ = "/tmp/leveldb_test"; | ||
|
|
||
| private: | ||
| void Reset() { std::filesystem::remove_all(path_.c_str()); } | ||
| }; | ||
|
|
||
| TEST_P(LevelDBTest, BlockCacheEnabled) { | ||
| if (GetParam() == CacheConfig::ENABLED) { | ||
| EXPECT_TRUE(storage->block_cache_ != nullptr); | ||
| EXPECT_TRUE(storage->block_cache_->GetCapacity() == 1000); | ||
| } else { | ||
| EXPECT_TRUE(storage->block_cache_ == nullptr); | ||
| EXPECT_FALSE(storage->UpdateMetrics()); | ||
| } | ||
| } | ||
|
|
||
| TEST_P(LevelDBTest, AddValueAndCheckCache) { | ||
| if (GetParam() == CacheConfig::ENABLED) { | ||
| // Add a value | ||
| std::string key = "test_key"; | ||
| std::string value = "test_value"; | ||
| EXPECT_EQ(storage->SetValue(key, value), 0); | ||
|
|
||
| // Check if CacheHit is incremented in the Stats class | ||
| EXPECT_TRUE(storage->block_cache_->Get(key) == "test_value"); | ||
| EXPECT_EQ(storage->block_cache_->GetCacheHits(), 1); | ||
| } | ||
| } | ||
|
|
||
| TEST_P(LevelDBTest, CacheEvictionPolicy) { | ||
| if (GetParam() == CacheConfig::ENABLED) { | ||
| // Insert 1000 values | ||
| for (int i = 1; i <= 1000; ++i) { | ||
| std::string key = "key_" + std::to_string(i); | ||
| std::string value = "value_" + std::to_string(i); | ||
| EXPECT_EQ(storage->SetValue(key, value), 0); | ||
| } | ||
|
|
||
| // Insert the 1001st value | ||
| std::string key_1001 = "key_1001"; | ||
| std::string value_1001 = "value_1001"; | ||
| EXPECT_EQ(storage->SetValue(key_1001, value_1001), 0); | ||
|
|
||
| // Check that the 1001st value is not present in the cache | ||
| EXPECT_TRUE(storage->GetValue("key_1") == "value_1"); | ||
| EXPECT_EQ(storage->block_cache_->GetCacheMisses(), 1); | ||
|
|
||
| // Expect key_2 to be present in cache and hence a cache hit | ||
| EXPECT_TRUE(storage->GetValue("key_2") == "value_2"); | ||
| EXPECT_EQ(storage->block_cache_->GetCacheHits(), 1); | ||
|
|
||
| EXPECT_TRUE(storage->UpdateMetrics()); | ||
| } | ||
| } | ||
|
|
||
| INSTANTIATE_TEST_CASE_P(LevelDBTest, LevelDBTest, | ||
| ::testing::Values(CacheConfig::ENABLED, | ||
| CacheConfig::DISABLED)); | ||
|
|
||
| } // namespace | ||
| } // namespace storage | ||
| } // namespace resdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.