Adventures with Memory Barriers and Seastar on Linux

Introduction

Seastar Inter-thread Communication Backgrounder

Basic Lock-free Single-producer/Single-consumer Queues

The Complications of Sleeping

Moving Work to Idle Cores

  • If the signal was executed before the producer pushed any messages into the queue, then the producer will notice that the consumer is sleeping (or trying to sleep)
  • If the signal was executed after the producer checked consumer_is_sleeping, then the consumer will notice that messages were pushed into the queue and avoid sleeping
  • If the signal was executed after the producer pushed any messages into the queue, but before it checked consumer_is_sleeping, then both the producer and the consumer will notice the race (with one sending an unneeded wakeup, and the other avoiding sleep)

Injecting Barriers with mprotect()

Not So Fast

membarrier() to the Rescue

Performance Evaluation

Conclusion

--

--

--

The monstrously-fast NoSQL database.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Doubling Down on Linked List — Part Two

Quality of code is quality of life: Python Code Analysis on Azure DevOps with SonarQube

Resolve Hibernate and JPA N+1 problem

DATABASE SYSTEM AND ARCHITECTURE

403.16 — Client certificate is untrusted of invalid

A Guide To Python Data Classes

Cloud computing service models

Windows Sucks Without PowerToys: 10 Tools To Power Up Your PC

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ScyllaDB

ScyllaDB

The monstrously-fast NoSQL database.

More from Medium

Part 2: Grpc Proto Code Generation Using Protoc for Message and Services

Designing a Distributed System for an Online Multiplayer Game — Architecture (Part 3)

Using the TiDB Upgrade Toolkit to Guarantee a Safe Database Upgrade

Reducing costs for large caches in Go: Eliminating the memory overhead of the garbage collector