jodosha / activerecord-pessimistic-locking

Reproduce ActiveRecord pessimistic locking in a multi-threaded environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

Reproduce ActiveRecord pessimistic locking strategy in a multi-threaded environment.

Requirements

  • Ruby / Bundler
  • Foreman
  • PostgreSQL
  • Kafka

How to run the test

  1. Clone this repository
  2. Start PostgreSQL & Kafka
  3. Run bin/setup
  4. Run foreman start
  5. In another shell run bundle exec rails dbconsole and then SELECT * FROM inbound_events ORDER BY id. Verify that id, offset, and counter (from payload) are all progressive numbers. This is the proof that they were stored in the same order they were produced (according to outbound_events.published_at)

About

Reproduce ActiveRecord pessimistic locking in a multi-threaded environment


Languages

Language:Ruby 85.2%Language:HTML 12.9%Language:CSS 1.7%Language:JavaScript 0.2%