Commit fc21fe81 authored by 蔡宇东's avatar 蔡宇东
Browse files

MS-574 add GET config APIs


Former-commit-id: 4b2cb939e1f93b25b1de6db387f5e07cbd8ed6d1
parent 22a0970f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -5,13 +5,13 @@ server_config:
  time_zone: UTC+8

db_config:
  db_path: @MILVUS_DB_PATH@     # milvus database path
  db_slave_path:                # secondary database path, split by semicolon
  path: @MILVUS_DB_PATH@        # milvus database path
  slave_path:                   # secondary database path, split by semicolon

  # URI format: dialect://username:password@host:port/database
  # All parts except dialect are optional, but you MUST include the delimiters
  # Currently dialect supports mysql or sqlite
  db_backend_url: sqlite://:@:/
  backend_url: sqlite://:@:/

  archive_disk_threshold: 0     # GB, file will be archived when disk usage exceed, 0 for no limit
  archive_days_threshold: 0     # DAYS, older files will be archived, 0 for no limit
@@ -27,7 +27,7 @@ metric_config:
cache_config:
  cpu_mem_capacity: 16          # GB, CPU memory size used for cache
  cpu_mem_threshold: 0.85       # percent of data kept when cache cleanup triggered
  insert_immediately: false     # whether load data into cache when insert
  cache_insert_data: false      # whether load data into cache when insert

engine_config:
  blas_threshold: 20
+7 −10
Original line number Diff line number Diff line
@@ -29,19 +29,16 @@ namespace {
}

CpuCacheMgr::CpuCacheMgr() {
    server::ConfigNode& config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_CACHE);
    int64_t cap =
        config.GetInt64Value(server::CONFIG_CACHE_CPU_MEM_CAPACITY, std::stoi(server::CONFIG_CACHE_CPU_MEM_CAPACITY_DEFAULT));
    cap *= unit;
    server::ServerConfig& config = server::ServerConfig::GetInstance();
    int64_t cap = config.GetCacheConfigCpuMemCapacity() * unit;
    cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL<<32);

    double free_percent =
        config.GetDoubleValue(server::CONFIG_CACHE_CPU_MEM_THRESHOLD, std::stof(server::CONFIG_CACHE_CPU_MEM_THRESHOLD_DEFAULT));
    if(free_percent > 0.0 && free_percent <= 1.0) {
        cache_->set_freemem_percent(free_percent);
    float cpu_mem_threshold = config.GetCacheConfigCpuMemThreshold();
    if (cpu_mem_threshold > 0.0 && cpu_mem_threshold <= 1.0) {
        cache_->set_freemem_percent(cpu_mem_threshold);
    } else {
        SERVER_LOG_ERROR << "Invalid cache_free_percent: " << free_percent <<
         ", defaultly set to " << cache_->freemem_percent();
        SERVER_LOG_ERROR << "Invalid cpu_mem_threshold: " << cpu_mem_threshold
                         << ", by default set to " << cache_->freemem_percent();
    }
}

+7 −10
Original line number Diff line number Diff line
@@ -33,20 +33,17 @@ namespace {
}

GpuCacheMgr::GpuCacheMgr() {
    server::ConfigNode& config = server::ServerConfig::GetInstance().GetConfig(server::CONFIG_CACHE);
    server::ServerConfig& config = server::ServerConfig::GetInstance();

    int64_t cap =
        config.GetInt64Value(server::CONFIG_CACHE_GPU_MEM_CAPACITY, std::stoi(server::CONFIG_CACHE_GPU_MEM_CAPACITY_DEFAULT));
    cap *= G_BYTE;
    int32_t cap = config.GetCacheConfigGpuMemCapacity() * G_BYTE;
    cache_ = std::make_shared<Cache<DataObjPtr>>(cap, 1UL<<32);

    double free_percent =
        config.GetDoubleValue(server::CONFIG_CACHE_GPU_MEM_THRESHOLD, std::stof(server::CONFIG_CACHE_GPU_MEM_THRESHOLD_DEFAULT));
    if (free_percent > 0.0 && free_percent <= 1.0) {
        cache_->set_freemem_percent(free_percent);
    float gpu_mem_threshold = config.GetCacheConfigGpuMemThreshold();
    if (gpu_mem_threshold > 0.0 && gpu_mem_threshold <= 1.0) {
        cache_->set_freemem_percent(gpu_mem_threshold);
    } else {
        SERVER_LOG_ERROR << "Invalid gpu_cache_free_percent: " << free_percent <<
                         ", defaultly set to " << cache_->freemem_percent();
        SERVER_LOG_ERROR << "Invalid gpu_mem_threshold: " << gpu_mem_threshold
                         << ", by default set to " << cache_->freemem_percent();
    }
}

+1 −2
Original line number Diff line number Diff line
@@ -335,8 +335,7 @@ Status ExecutionEngineImpl::GpuCache(uint64_t gpu_id) {
Status ExecutionEngineImpl::Init() {
    using namespace zilliz::milvus::server;
    ServerConfig &config = ServerConfig::GetInstance();
    ConfigNode server_config = config.GetConfig(CONFIG_DB);
    gpu_num_ = server_config.GetInt32Value(CONFIG_DB_BUILD_INDEX_GPU, std::stoi(CONFIG_DB_BUILD_INDEX_GPU_DEFAULT));
    gpu_num_ = config.GetDBConfigBuildIndexGPU();

    return Status::OK();
}
+3 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
// under the License.

#include "Metrics.h"
#include "server/ServerConfig.h"
#include "PrometheusMetrics.h"


@@ -31,9 +32,8 @@ Metrics::GetInstance() {

MetricsBase &
Metrics::CreateMetricsCollector() {
    ConfigNode &config = ServerConfig::GetInstance().GetConfig(CONFIG_METRIC);
    std::string collector_type_str =
        config.GetValue(CONFIG_METRIC_COLLECTOR, CONFIG_METRIC_COLLECTOR_DEFAULT);
    ServerConfig &config = ServerConfig::GetInstance();
    std::string collector_type_str = config.GetMetricConfigCollector();

    if (collector_type_str == "prometheus") {
        return PrometheusMetrics::GetInstance();
Loading