Unverified Commit c63a50c6 authored by BossZou's avatar BossZou Committed by GitHub
Browse files

Allow system conf modifiable and some take effect directly #1263 (#1287)



* finish configure modifiable and some take effect runtime

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* move test file to unittet folder

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add test case for cofig

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* fix format issue

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* optimize callback

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* fix error when get config by http in CPU mode

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* update callback map

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* correct typo

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* update callback register

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add identity in registers

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add identity in FaissPass class

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add comments at cmd test if fail

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* remove some comments and add test for validate storage path

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* format pass

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* remove endpoint info and update CORS

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add test case in web module to test drop a non-existent table

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* optimize config store

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add check code in config

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add scheduler gpu handler

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* update optimizer faiss pass

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add default value of gpu_enable_ in GpuCacheMgr

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* optimize code: remove comments

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* format pass

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* add gpu macro in optimizer handler module to fix compile bug on cpu version

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* change cache setting unit  bytes

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>

* rename variables

Signed-off-by: default avatarYhz <yinghao.zou@zilliz.com>
parent a55cb9fe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ Please mark all change in change log and use the issue from GitHub
- \#1078 - Move 'insert_buffer_size' to Cache Config section
- \#1105 - Error message is not clear when creating IVFSQ8H index without gpu resources
- \#740, #849, #878, #972, #1033, #1161, #1173, #1199, #1190, #1223, #1222, #1257, #1264, #1269, #1164, #1303, #1304, #1324 - Various fixes and improvements for Milvus documentation.
- \#1263 - Allow system conf modifiable and some take effect directly
- \#1320 - Remove debug logging from faiss

## Task
+1 −0
Original line number Diff line number Diff line
milvus/
conf/server_config.yaml
conf/server_config.yaml.ori
conf/log_config.conf
src/config.h
src/version.h
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/action scheduler_action_file
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/event scheduler_event_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/job scheduler_job_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/optimizer scheduler_optimizer_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/optimizer/handler scheduler_optimizer_handler_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/resource scheduler_resource_files)
aux_source_directory(${MILVUS_ENGINE_SRC}/scheduler/task scheduler_task_files)
set(scheduler_files
@@ -57,6 +58,7 @@ set(scheduler_files
        ${scheduler_event_files}
        ${scheduler_job_files}
        ${scheduler_optimizer_files}
        ${scheduler_optimizer_handler_files}
        ${scheduler_resource_files}
        ${scheduler_task_files}
        )
+22 −0
Original line number Diff line number Diff line
@@ -32,6 +32,15 @@ GpuCacheMgr::GpuCacheMgr() {
    // All config values have been checked in Config::ValidateConfig()
    server::Config& config = server::Config::GetInstance();

    config.GenUniqueIdentityID("GpuCacheMar", identity_);

    config.GetGpuResourceConfigEnable(gpu_enable_);
    server::ConfigCallBackF lambda = [this](const std::string& value) -> Status {
        auto& config = server::Config::GetInstance();
        return config.GetGpuResourceConfigEnable(this->gpu_enable_);
    };
    config.RegisterCallBack(server::CONFIG_GPU_RESOURCE, server::CONFIG_GPU_RESOURCE_ENABLE, identity_, lambda);

    int64_t gpu_cache_cap;
    config.GetGpuResourceConfigCacheCapacity(gpu_cache_cap);
    int64_t cap = gpu_cache_cap * G_BYTE;
@@ -42,6 +51,11 @@ GpuCacheMgr::GpuCacheMgr() {
    cache_->set_freemem_percent(gpu_mem_threshold);
}

GpuCacheMgr::~GpuCacheMgr() {
    server::Config& config = server::Config::GetInstance();
    config.CancelCallBack(server::CONFIG_GPU_RESOURCE, server::CONFIG_GPU_RESOURCE_ENABLE, identity_);
}

GpuCacheMgr*
GpuCacheMgr::GetInstance(uint64_t gpu_id) {
    if (instance_.find(gpu_id) == instance_.end()) {
@@ -61,6 +75,14 @@ GpuCacheMgr::GetIndex(const std::string& key) {
    DataObjPtr obj = GetItem(key);
    return obj;
}

void
GpuCacheMgr::InsertItem(const std::string& key, const milvus::cache::DataObjPtr& data) {
    if (gpu_enable_) {
        CacheMgr<DataObjPtr>::InsertItem(key, data);
    }
}

#endif

}  // namespace cache
+7 −0
Original line number Diff line number Diff line
@@ -27,13 +27,20 @@ class GpuCacheMgr : public CacheMgr<DataObjPtr> {
 public:
    GpuCacheMgr();

    ~GpuCacheMgr();

    static GpuCacheMgr*
    GetInstance(uint64_t gpu_id);

    DataObjPtr
    GetIndex(const std::string& key);

    void
    InsertItem(const std::string& key, const DataObjPtr& data);

 private:
    bool gpu_enable_ = true;
    std::string identity_;
    static std::mutex mutex_;
    static std::unordered_map<uint64_t, GpuCacheMgrPtr> instance_;
};
Loading