Strictly serializable datastores greatly simplify the development of correct applications by providing strong consistency guarantees. However, existing techniques pay unnecessary costs for naturally consistent transactions, which arrive at servers in an order that is already strictly serializable. We find these transactions are prevalent in datacenter workloads. We exploit this natural arrival order by executing transaction requests with minimal costs while optimistically assuming they are naturally consistent, and then leverage a timestamp-based technique to efficiently verify if the execution is indeed consistent. In the process of designing such a timestamp-based technique, we identify a fundamental pitfall in relying on timestamps to provide strict serializability, and name it the timestamp-inversion pitfall. We find timestamp-inversion has affected several existing works. We present Natural Concurrency Control (NCC), a new concurrency control technique that guarantees strict serializability and ensures minimal costs -- i.e., one-round latency, lock-free, and non-blocking execution -- in the best (and common) case by leveraging natural consistency. NCC is enabled by three key components: non-blocking execution, decoupled response control, and timestamp-based consistency check. NCC avoids timestamp-inversion with a new technique: response timing control, and proposes two optimization techniques, asynchrony-aware timestamps and smart retry, to reduce false aborts. Moreover, NCC designs a specialized protocol for read-only transactions, which is the first to achieve the optimal best-case performance while ensuring strict serializability, without relying on synchronized clocks. Our evaluation shows that NCC outperforms state-of-the-art solutions by an order of magnitude on many workloads.
翻译:严格可序列化数据存储通过提供强一致性保证,极大简化了正确应用程序的开发。然而,现有技术对自然一致的事务付出了不必要的代价——这些事务到达服务器的顺序本身已满足严格可序列化。我们发现这类事务在数据中心工作负载中普遍存在。我们通过以最小成本执行事务请求(乐观假设它们自然一致)来利用这种自然到达顺序,并利用基于时间戳的技术高效验证执行是否确实一致。在设计此类时间戳技术的过程中,我们识别出依赖时间戳提供严格可序列化性时的一个根本性陷阱,并将其命名为时间戳反转陷阱。我们发现时间戳反转已影响多个现有工作。我们提出自然并发控制(NCC),这是一种新型并发控制技术,通过利用自然一致性,在最佳(且常见)情况下保证严格可序列化性并确保最小成本——即单轮延迟、无锁且无阻塞执行。NCC由三个关键组件实现:无阻塞执行、解耦响应控制和基于时间戳的一致性检查。NCC通过一项新技术——响应时序控制——避免时间戳反转,并提出两种优化技术(异步感知时间戳和智能重试)以减少误终止。此外,NCC为只读事务设计了专用协议,该协议是首个在无需同步时钟的前提下,实现最佳情况性能优化并确保严格可序列化性的方案。我们的评估表明,在多种工作负载下,NCC的性能比现有最优解决方案高出一个数量级。