Skip to content
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

fix(interactive): add memory level option for interactive server #3877

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions flex/bin/interactive_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void init_codegen_proxy(const bpo::variables_map& vm,
}

void openDefaultGraph(const std::string workspace, int32_t thread_num,
const std::string& default_graph) {
const std::string& default_graph, uint32_t memory_level) {
if (!std::filesystem::exists(workspace)) {
LOG(ERROR) << "Workspace directory not exists: " << workspace;
}
Expand Down Expand Up @@ -126,7 +126,12 @@ void openDefaultGraph(const std::string workspace, int32_t thread_num,
<< ", for graph: " << default_graph;
}
db.Close();
if (!db.Open(schema_res.value(), data_dir, thread_num).ok()) {
gs::GraphDBConfig config(schema_res.value(), data_dir, thread_num);
config.memory_level = memory_level;
if (config.memory_level >= 2) {
config.enable_auto_compaction = true;
}
if (!db.Open(config).ok()) {
LOG(FATAL) << "Fail to load graph from data directory: " << data_dir;
}
LOG(INFO) << "Successfully init graph db for default graph: "
Expand Down Expand Up @@ -164,7 +169,9 @@ int main(int argc, char** argv) {
"enable-trace", bpo::value<bool>()->default_value(false),
"whether to enable opentelemetry tracing")(
"start-compiler", bpo::value<bool>()->default_value(false),
"whether or not to start compiler");
"whether or not to start compiler")(
"memory-level,m", bpo::value<unsigned>()->default_value(1),
"memory allocation strategy");

setenv("TZ", "Asia/Shanghai", 1);
tzset();
Expand Down Expand Up @@ -195,6 +202,7 @@ int main(int argc, char** argv) {
service_config.engine_config_path = engine_config_file;
service_config.start_admin_service = vm["enable-admin-service"].as<bool>();
service_config.start_compiler = vm["start-compiler"].as<bool>();
service_config.memory_level = vm["memory-level"].as<unsigned>();

auto& db = gs::GraphDB::get();

Expand All @@ -218,7 +226,8 @@ int main(int argc, char** argv) {
}

gs::openDefaultGraph(workspace, service_config.shard_num,
service_config.default_graph);
service_config.default_graph,
service_config.memory_level);
// Suppose the default_graph is already loaded.
LOG(INFO) << "Finish init workspace";
auto schema_file = server::WorkDirManipulator::GetGraphSchemaPath(
Expand Down
1 change: 1 addition & 0 deletions flex/engines/http_server/service/hqps_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct ServiceConfig {
uint32_t admin_port;
uint32_t query_port;
uint32_t shard_num;
uint32_t memory_level;
bool dpdk_mode;
bool enable_thread_resource_pool;
unsigned external_thread_num;
Expand Down
2 changes: 1 addition & 1 deletion flex/scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ popd && rm -rf /tmp/apache-arrow-apt-source-latest.deb

# install opentelemetry
cd /tmp
git clone https://github.com/open-telemetry/opentelemetry-cpp
git clone https://github.com/open-telemetry/opentelemetry-cpp -b v1.15.0
cd opentelemetry-cpp
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON \
Expand Down
Loading