山东省建设工程领域挂证存颖网站,做网站小图标,湖南关键词优化首选,项目网格化管理方案IVF_FLAT (Inverted File with Flat Indexing)
优点:
在数据量适中且维度不是非常高的情况下#xff0c;IVF_FLAT能提供精确的最近邻搜索结果。
相对简单#xff0c;易于理解和实现。
缺点:
当数据集非常大时#xff0c;IVF_FLAT需要大量的内存来存储整个数据集#xff0c;…IVF_FLAT (Inverted File with Flat Indexing)
优点:
在数据量适中且维度不是非常高的情况下IVF_FLAT能提供精确的最近邻搜索结果。
相对简单易于理解和实现。
缺点:
当数据集非常大时IVF_FLAT需要大量的内存来存储整个数据集这可能导致性能瓶颈。
检索速度随着数据集的增长而显著降低因为需要与所有候选数据点计算相似度。
HNSW (Hierarchical Navigable Small World Graphs)
优点:
HNSW特别适合高维数据能够在大规模数据集上提供高效的近似最近邻搜索。
即使数据集很大HNSW也能保持较快的查询速度。
缺点:
HNSW的构建过程可能较为复杂和耗时尤其是在数据流式更新的情况下。
结果为近似最近邻虽然通常足够准确但在某些场景下可能不如IVF_FLAT精确。
对于小数据场景特别是如果数据量不大且可以接受较高的内存消耗IVF_FLAT可能是一个更好的选择因为它能提供精确的结果。然而如果数据集的维度非常高或者你希望优化查询速度即使数据量较小HNSW仍然可能是更优的选择。
在实际应用中选择哪一种算法还应考虑具体业务需求比如是否可以容忍近似结果、系统资源限制、以及是否需要实时更新索引等因素。如果数据量和维度都不大而且对查询速度的要求不是特别高那么IVF_FLAT可能就足够了但如果需要在高维数据上进行快速查询HNSW则更加合适。
HNSW 分层可导航小世界图索引
1.M
M是一个关键参数它定义了图中每个节点的最大出边数即每个节点可以连接到的最多其他节点的数量
在HNSW的多级图结构中M控制着图的连通性和密度。
2.efConstruction
efConstruction定义了在构建图时算法为每个节点寻找最近邻时考虑的候选节点数量。换句话说它是构建索引过程中用于决定每个节点连接哪些其他节点的探索因子。
它控制了算法在添加新节点时考虑的候选邻居数量。当添加一个新节点时算法会从当前图中选取efConstruction个节点作为候选并从中挑选出最佳的邻居节点来建立连接
3.ef-search
ef_search有时简写为 ef是HNSWHierarchical Navigable Small World graphs算法中用于查询阶段的一个重要参数。在查询时ef_search定义了算法在试图找到最近邻时考虑的候选节点数量。
它控制着搜索的广度即算法在搜索图时愿意检查多少条边。
ef_search 控制搜索过程的效率和精度它影响算法在搜索时探索的路径数量。
4.k
k通常是指查询时返回的最近邻nearest neighbors的数量IVF_FALT 带平面索引的倒排文件
lists
lists参数实际上指的是nlist它是IVF_FLAT索引中聚类或列表的数量。nlist决定了数据集被分割成多少个子集。
probes
probes参数是指在搜索时实际检查的聚类数量官网地址如下 https://zilliz.com/vector-database-benchmark-tool?databaseZillizCloud%2CMilvus%2CElasticCloud%2CPgVector%2CPinecone%2CQdrantCloud%2CWeaviateClouddatasetmediumfilternone%2Clow%2Chightab1
https://gitee.com/woohello/VectorDBBench
1.前置条件 1.python 3.11 Ssl 问题解决 https://cloud.tencent.com/developer/article/2424089 https://blog.csdn.net/qq_43370607/article/details/137382955
pip install vectordb-bench1.ivf_flat 性能验证
nohup ./ivf_flat.sh /root/octopus/benchmarker/dimension/ivf_flat.log 21 /usr/local/python3.12/bin/vectordbbench milvusivfflat --uri http://xxxxx:32437 --drop-old --lists 1024 --probes 5{run_id: 09c01adfa7a5470ea6176855cccd5628,task_label: 09c01adfa7a5470ea6176855cccd5628,results: [{metrics: {max_load_count: 0,load_duration: 158.9442,qps: 3031.743,serial_latency_p99: 0.008,recall: 0.5065,ndcg: 0.5493,conc_num_list: [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],conc_qps_list: [175.7321, 838.1756, 1328.4196, 1676.7759, 1885.2717, 2329.0303, 2238.8839, 2307.6002, 2418.9697, 2502.9213, 2628.4562, 2611.9513, 2631.2078, 2709.1865, 2751.1792, 2749.1104, 2792.9155, 2752.8945, 2836.4445, 2904.4609, 3031.743],conc_latency_p99_list: [0.004655693072453141, 0.004652024507522583, 0.004790452426299453, 0.005058524944633246, 0.0053853894943371415, 0.00560504300147295, 0.005771844685822725, 0.006148010149598122, 0.006257654917612672, 0.00643803995847702, 0.006523223061859608, 0.00653654379490763, 0.0069596841046586635, 0.00731352926902473, 0.007371303759515286, 0.007228717562556266, 0.007472157787531615, 0.0074205820478498935, 0.006961745805479586, 0.008283554406836629, 0.0073261844931170345]},task_config: {db: Milvus,db_config: {db_label: 2024-07-30T14:43:55.771839,uri: **********},db_case_config: {index: IVF_FLAT,metric_type: COSINE,nlist: 1024,nprobe: 5},case_config: {case_id: 50,custom_case: null,k: 100,concurrency_search_config: {num_concurrency: [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],concurrency_duration: 30}},stages: [drop_old, load, search_serial, search_concurrent]},label: :)}],file_fmt: result_{}_{}_{}.json
} 2.hnsw 性能验证 条件–m 8 --ef-construction 64 --ef-search 10 --k 10
nohup ./hnsw_10.sh /root/octopus/benchmarker/dimension/hnsw_10.log 21 /usr/local/python3.12/bin/vectordbbench milvushnsw --uri http://172.20.1.101:32437 --drop-old --m 8 --ef-construction 64 --ef-search 10 --k 10{run_id: 1c945b28090941c7ae58ec55a8ae0ecb,task_label: 1c945b28090941c7ae58ec55a8ae0ecb,results: [{metrics: {max_load_count: 0,load_duration: 138.8369,qps: 3857.9497,serial_latency_p99: 0.006,recall: 0.6946,ndcg: 0.7127,conc_num_list: [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],conc_qps_list: [205.9066, 896.0748, 1535.6513, 1961.4574, 2282.5936, 2486.9112, 2473.0187, 2639.9002, 2792.597, 2825.9357, 2985.0966, 2992.8825, 3202.8998, 3336.8242, 3480.6602, 3195.9544, 3206.5109, 3249.2361, 3527.203, 3528.9396, 3857.9497],conc_latency_p99_list: [0.004022291118651628, 0.003988313633389771, 0.004059490236081183, 0.0042587881341576575, 0.004422521588951349, 0.0045851776339113715, 0.0050087556691840295, 0.005091396714560687, 0.005392795985937118, 0.005527270000986755, 0.00542353574000299, 0.005898943385109305, 0.005861698154173791, 0.006148975464701652, 0.006199899067729712, 0.006067702007293701, 0.006825755665823817, 0.006885729782283306, 0.006695127539336682, 0.0061551205324009055, 0.006313137001730501]},task_config: {db: Milvus,db_config: {db_label: 2024-07-30T15:32:41.701653,uri: **********},db_case_config: {index: HNSW,metric_type: COSINE,M: 8,efConstruction: 64,ef: 10},case_config: {case_id: 50,custom_case: null,k: 10,concurrency_search_config: {num_concurrency: [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],concurrency_duration: 30}},stages: [drop_old, load, search_serial, search_concurrent]},label: :)}],file_fmt: result_{}_{}_{}.json
}
2.hnsw 性能验证 条件 --m 8 --ef-construction 64 --ef-search 64 --k 64
nohup ./hnsw_10.sh /root/octopus/benchmarker/dimension/hnsw_64.log 21 {run_id: 0112f04d884a48e7b04a79601b501f43,task_label: 0112f04d884a48e7b04a79601b501f43,results: [{metrics: {max_load_count: 0,load_duration: 99.8713,qps: 3590.8011,serial_latency_p99: 0.0068,recall: 0.6842,ndcg: 0.6988,conc_num_list: [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],conc_qps_list: [204.2923, 903.9947, 1569.658, 1960.1058, 2254.7686, 2555.6955, 2661.9067, 2884.7484, 2974.3032, 2975.3197, 2988.5105, 3178.9354, 3299.7453, 3396.6382, 3327.4601, 3397.9266, 3465.914, 3466.3555, 3471.6151, 3504.3056, 3590.8011],conc_latency_p99_list: [0.004091060114465654, 0.003925692438334226, 0.004029340751469135, 0.004241374858655035, 0.0044741668567061426, 0.004661575911566615, 0.004779618114605546, 0.00496285007596016, 0.005089158420264721, 0.005570173567533493, 0.005635122420825064, 0.0056590593174099925, 0.005516276902705431, 0.0058326821969822045, 0.005921696238219737, 0.006209327307716011, 0.006015772367082536, 0.0063866944853216406, 0.0059822171421721575, 0.005861425867676735, 0.00654305313937366]},task_config: {db: Milvus,db_config: {db_label: 2024-07-30T16:03:25.006315,uri: **********},db_case_config: {index: HNSW,metric_type: COSINE,M: 8,efConstruction: 64,ef: 10},case_config: {case_id: 50,custom_case: null,k: 10,concurrency_search_config: {num_concurrency: [1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],concurrency_duration: 30}},stages: [drop_old, load, search_serial, search_concurrent]},label: :)}],file_fmt: result_{}_{}_{}.json
} 文章转载自: http://www.morning.sqhlx.cn.gov.cn.sqhlx.cn http://www.morning.qkrqt.cn.gov.cn.qkrqt.cn http://www.morning.kpygy.cn.gov.cn.kpygy.cn http://www.morning.tslxr.cn.gov.cn.tslxr.cn http://www.morning.pqwhk.cn.gov.cn.pqwhk.cn http://www.morning.nhlnh.cn.gov.cn.nhlnh.cn http://www.morning.sbdqy.cn.gov.cn.sbdqy.cn http://www.morning.crhd.cn.gov.cn.crhd.cn http://www.morning.rwpjq.cn.gov.cn.rwpjq.cn http://www.morning.lfpdc.cn.gov.cn.lfpdc.cn http://www.morning.mtymb.cn.gov.cn.mtymb.cn http://www.morning.clzly.cn.gov.cn.clzly.cn http://www.morning.dskmq.cn.gov.cn.dskmq.cn http://www.morning.cpwmj.cn.gov.cn.cpwmj.cn http://www.morning.ybhjs.cn.gov.cn.ybhjs.cn http://www.morning.yldgw.cn.gov.cn.yldgw.cn http://www.morning.kcxtz.cn.gov.cn.kcxtz.cn http://www.morning.gjlml.cn.gov.cn.gjlml.cn http://www.morning.807yy.cn.gov.cn.807yy.cn http://www.morning.wnjsp.cn.gov.cn.wnjsp.cn http://www.morning.xxrwp.cn.gov.cn.xxrwp.cn http://www.morning.wwznd.cn.gov.cn.wwznd.cn http://www.morning.gjxr.cn.gov.cn.gjxr.cn http://www.morning.frtt.cn.gov.cn.frtt.cn http://www.morning.pzdxg.cn.gov.cn.pzdxg.cn http://www.morning.pqnpd.cn.gov.cn.pqnpd.cn http://www.morning.rwcw.cn.gov.cn.rwcw.cn http://www.morning.snnwx.cn.gov.cn.snnwx.cn http://www.morning.tmnyj.cn.gov.cn.tmnyj.cn http://www.morning.twwts.com.gov.cn.twwts.com http://www.morning.drytb.cn.gov.cn.drytb.cn http://www.morning.kkhf.cn.gov.cn.kkhf.cn http://www.morning.mjpgl.cn.gov.cn.mjpgl.cn http://www.morning.krzrg.cn.gov.cn.krzrg.cn http://www.morning.qxltp.cn.gov.cn.qxltp.cn http://www.morning.bkppb.cn.gov.cn.bkppb.cn http://www.morning.xqjz.cn.gov.cn.xqjz.cn http://www.morning.xhlht.cn.gov.cn.xhlht.cn http://www.morning.nwynx.cn.gov.cn.nwynx.cn http://www.morning.prgdy.cn.gov.cn.prgdy.cn http://www.morning.mpsnb.cn.gov.cn.mpsnb.cn http://www.morning.pluimers.cn.gov.cn.pluimers.cn http://www.morning.rjmd.cn.gov.cn.rjmd.cn http://www.morning.dfbeer.com.gov.cn.dfbeer.com http://www.morning.sgwr.cn.gov.cn.sgwr.cn http://www.morning.nfdty.cn.gov.cn.nfdty.cn http://www.morning.mjbjq.cn.gov.cn.mjbjq.cn http://www.morning.qrwjb.cn.gov.cn.qrwjb.cn http://www.morning.mqxrx.cn.gov.cn.mqxrx.cn http://www.morning.ngcbd.cn.gov.cn.ngcbd.cn http://www.morning.yrhsg.cn.gov.cn.yrhsg.cn http://www.morning.lwqst.cn.gov.cn.lwqst.cn http://www.morning.cqwb25.cn.gov.cn.cqwb25.cn http://www.morning.snmsq.cn.gov.cn.snmsq.cn http://www.morning.rdtp.cn.gov.cn.rdtp.cn http://www.morning.sxygc.cn.gov.cn.sxygc.cn http://www.morning.xgxbr.cn.gov.cn.xgxbr.cn http://www.morning.rszyf.cn.gov.cn.rszyf.cn http://www.morning.wgzzj.cn.gov.cn.wgzzj.cn http://www.morning.qbwbs.cn.gov.cn.qbwbs.cn http://www.morning.yllym.cn.gov.cn.yllym.cn http://www.morning.zlces.com.gov.cn.zlces.com http://www.morning.rtsx.cn.gov.cn.rtsx.cn http://www.morning.bgqqr.cn.gov.cn.bgqqr.cn http://www.morning.pbygt.cn.gov.cn.pbygt.cn http://www.morning.slmbg.cn.gov.cn.slmbg.cn http://www.morning.knngw.cn.gov.cn.knngw.cn http://www.morning.mmhaoma.com.gov.cn.mmhaoma.com http://www.morning.prysb.cn.gov.cn.prysb.cn http://www.morning.langlaitech.cn.gov.cn.langlaitech.cn http://www.morning.wdply.cn.gov.cn.wdply.cn http://www.morning.kgqww.cn.gov.cn.kgqww.cn http://www.morning.nfzw.cn.gov.cn.nfzw.cn http://www.morning.npbgj.cn.gov.cn.npbgj.cn http://www.morning.dwzwm.cn.gov.cn.dwzwm.cn http://www.morning.bsrcr.cn.gov.cn.bsrcr.cn http://www.morning.flncd.cn.gov.cn.flncd.cn http://www.morning.nzkkh.cn.gov.cn.nzkkh.cn http://www.morning.hypng.cn.gov.cn.hypng.cn http://www.morning.mdwlg.cn.gov.cn.mdwlg.cn