arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2204.00764cs.DC
收藏

Golang中的真实世界数据竞赛研究

A Study of Real-World Data Races in Golang

Milind Chabbi, Murali Krishna Ramanathan

摘要:

并发编程文献中有很多用于数据竞争检测的工具和技术。然而,人们对真实世界、行业规模的部署、经验和关于数据竞赛的见解知之甚少。Golang(简称Go)是一种现代程序设计语言,它使并发成为一等公民。Go语言为并发线程之间的通信提供了消息传递和共享内存。Go在现代基于微服务的系统中越来越受欢迎。围棋中的数据竞赛与其新兴的流行趋势背道而驰。在本文中,使用我们的工业代码库作为一个例子,我们证明了Go开发人员接受并发,并显示了丰富的并发以及语言习惯和细微差别如何使Go程序非常容易受到数据竞争的影响。Google的Go发行版内置了一个基于ThreadSanitizer的动态数据竞争检测器。然而,动态竞争检测器带来了可扩展性和脆弱性的挑战,我们讨论了各种软件工程权衡,使这个检测器有效地工作在规模。我们已经在Uber的4600万行Go代码库中部署了这个检测器,这些代码库托管了2100个不同的微服务,发现了2000多个数据竞争,并修复了1000多个数据竞争,涵盖了210个独特的开发人员在六个月内提交的790个不同的代码补丁。基于对Go中这些数据竞争模式的详细调查,我们对Go语言范式和数据竞争之间的复杂相互作用进行了七次高层次的观察。

英文摘要:

The concurrent programming literature is rich with tools and techniques for data race detection. Less, however, has been known about real-world, industry-scale deployment, experience, and insights about data races. Golang (Go for short) is a modern programming language that makes concurrency a first-class citizen. Go offers both message passing and shared memory for communicating among concurrent threads. Go is gaining popularity in modern microservice-based systems. Data races in Go stand in the face of its emerging popularity. In this paper, using our industrial codebase as an example, we demonstrate that Go developers embrace concurrency and show how the abundance of concurrency alongside language idioms and nuances make Go programs highly susceptible to data races. Google's Go distribution ships with a built-in dynamic data race detector based on ThreadSanitizer. However, dynamic race detectors pose scalability and flakiness challenges; we discuss various software engineering trade-offs to make this detector work effectively at scale. We have deployed this detector in Uber's 46 million lines of Go codebase hosting 2100 distinct microservices, found over 2000 data races, and fixed over 1000 data races, spanning 790 distinct code patches submitted by 210 unique developers over a six-month period. Based on a detailed investigation of these data race patterns in Go, we make seven high-level observations relating to the complex interplay between the Go language paradigm and data races.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑