MemLens Database Specific Changes#170
Conversation
MemLens - V1 project commits
apratimshukla6
left a comment
There was a problem hiding this comment.
@cjcchen can you review and approve this?
chain/storage/BUILD
Outdated
| name = "leveldb", | ||
| srcs = ["leveldb.cpp"], | ||
| hdrs = ["leveldb.h"], | ||
| linkopts = ["-pg","-g","-ggdb"], # Enable profiling during linking |
There was a problem hiding this comment.
Only open this debug opts if needed.
Most of time, we dont to debug the code.
chain/storage/leveldb.cpp
Outdated
| } | ||
| } | ||
| if ((*config).enable_block_cache()) { | ||
| LRUCache<std::string, std::string>* block_cache = |
There was a problem hiding this comment.
When to destroy this pointer?
It looks like there is a memory leak.
You can use unique_pointer instead.
common/lru/lru_cache.cpp
Outdated
| return ValueType(); | ||
| } | ||
|
|
||
| auto it = std::find(dq_.begin(), dq_.end(), key); |
common/lru/lru_cache.cpp
Outdated
| } | ||
|
|
||
| auto it = std::find(dq_.begin(), dq_.end(), key); | ||
| dq_.erase(it); |
There was a problem hiding this comment.
| dq_.erase(it); | |
| if ( it != dq_.end()){ | |
| dq_.erase(it); | |
| } |
common/lru/lru_cache.h
Outdated
| int cache_hits_; // Cache hits count | ||
| int cache_misses_; // Cache misses count | ||
|
|
||
| deque<KeyType> dq_; // To maintain most and least recently used items |
There was a problem hiding this comment.
why not use link-list?
| @@ -0,0 +1,101 @@ | |||
| #include "lru_cache.h" | |||
|
Hi @harish876, Thanks for the contribution and it is a nice accomplishment. Thanks. |
|
Hi @cjcchen |
platform/statistic/stats.cpp
Outdated
| } | ||
| } | ||
|
|
||
| long getRSS() { |
There was a problem hiding this comment.
| long getRSS() { | |
| long GetRSS() { |
platform/statistic/stats.cpp
Outdated
| return 0; | ||
| } | ||
|
|
||
| unsigned long size, resident, share, text, lib, data, dt; |
There was a problem hiding this comment.
let's use int64_t and uint64_t other than long and unsigned long.
platform/statistic/stats.h
Outdated
| std::chrono::system_clock::time_point execution_time; | ||
|
|
||
| // Storage Engine Stats | ||
| double ext_cache_hit_ratio; |
There was a problem hiding this comment.
some naming issues. using "_" as the subfix.
Very nice job. |
|
Thanks @cjcchen , will resolve the additional comments |
…te metrics return type
|
Hi @cjcchen tried to resolve the comments. please do review once and let me know if further changes need to be made. thanks |
Very good job. One question here, what is the motivation to remove the O3 option? If this is optional to just for the profile tracing, we can add an introduction on how to enable the feature. |
|
yes @cjcchen . it was a mistake. corrected it now |
service/kv/BUILD
Outdated
| "//chain/storage/setting:enable_leveldb_setting": ["-DENABLE_LEVELDB"], | ||
| "//conditions:default": [], | ||
| "//chain/storage/setting:enable_leveldb_setting": ["-DENABLE_LEVELDB","-g","-ggdb"], | ||
| "//conditions:default": ["-pg", "-g", "-ggdb"], |
service/tools/kv/api_tools/BUILD
Outdated
| copts = ["-pg"], | ||
| linkopts = ["-pg"] |
Great. |
|
Hi @cjcchen. I have removed the debug flags. Our profiler only works when the build has debug information at the top level. I am unsure if profiling would work without the -pg flag. We do get kernel level metrics without the debug flag but userspace metrics are not available without that. Please do let us know what could be done here? |
Very cool! |
@harish876 did it build successfully on your end? https://github.com/apache/incubator-resilientdb/actions/runs/13852115218/job/38763569382 |
|
Yes @cjcchen , it did build with warnings albeit, but all TC's were a go. I will go through the failed checks. |
|
Hi @cjcchen , verified the build and unit tests again. I removed our profiling command, which needs to be installed. I will convert our setup to a sidecar. Please find my deployment results. I also have enabled LevelDB here, please do let me know if that is fine by you
|
"common/lru/lru_cache.cpp:21:1: note: 'std::string' is defined in header ''; did you forget to '#include '? it reports this. I think you just need to include to the header. |
|
Done @cjcchen |




Summary:
compile_commands.jsonto enable autocompletion and IntelliSense during development./transaction_datato export specific statistics to the frontend.Todo:
Bootstrap script like ./INSTALL.sh to install and setup all monitoring tools