← Graph

Apartment

tool 4 connections

Historically the de-facto standard Ruby gem for multi-tenancy in Rails, providing schema-per-tenant and database-per-tenant switching. For the database-per-tenant case, it re-establishes Active Record connections on switch — a pattern that is not thread-safe and can silently corrupt data on threaded servers like Puma, while being masked on fork servers like Unicorn. The original authors publicly stated the schema-level approach did not work for them in the long run.

category
library
Discussed as the historical de-facto standard for schema- and database-per-tenant multi-tenancy and its thread-safety issues.
Specifically about the apartment gem's thread-safety issue.
tool Apartment
related_to
Apartment was the de-facto implementation of schema-per-tenant.
tool Apartment
related_to
Apartment also supported database-per-tenant via connection re-establishment.

Provenance

Read by
15 extractions