检索规则说明:AND代表“并且”;OR代表“或者”;NOT代表“不包含”;(注意必须大写,运算符两边需空一格)
检 索 范 例 :范例一: (K=图书馆学 OR K=情报学) AND A=范并思 范例二:J=计算机应用与软件 AND (U=C++ OR U=Basic) NOT M=Visual
作 者:阮正平 蒋林峰 RUAN Zhengping;JIANG Linfeng(Aostar Information Technologies Co.,Ltd.,Chengdu,Sichuan Province,610041 China)
机构地区:[1]四川中电启明星信息技术有限公司,四川成都610000
出 处:《科技资讯》2023年第14期22-27,共6页Science & Technology Information
摘 要:在云原生领域,大多数项目都是用Go语言开发的,而Go语言标准库中的Map又是开发过程中常用的内置数据结构。但是,在官方的设计中,Map并不是一种并发安全的数据类型。因此,该文首先介绍了Map的设计,分析了它不是并发安全的原因,其次论述了并发安全的Map的实现方式,包括加锁、Go官方的sync.Map以及自己通过分片加锁实现的方式,并设计了两大类实验,对这几种实现方式进行基准测试,最后根据测试结果进行了分析与技术选型的建议。In the cloud-native field,most projects are developed in Golang,and the Map in the Golang standard library is a commonly used built-in data structure in the development process.However,in the official design,Map is not a data type of concurrent security.Therefore,this article introduces the design of Map,analyzes the reason why it is not concurrent security,next introduces the implementation of the Map of concurrent security,including locking,Go's official sync.Map and its own way of implementing it through shard locking,then designs two types of experiments to benchmark these implementations,and finally conducts the analysis and recommends technical selection based on test results.
关 键 词:Golang并发安全 sync.Map 分片加锁实现 实验设计 技术选型
分 类 号:TP31[自动化与计算机技术—计算机软件与理论]
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在载入数据...
正在链接到云南高校图书馆文献保障联盟下载...
云南高校图书馆联盟文献共享服务平台 版权所有©
您的IP:52.14.80.39