Comment

Comment by ninkendo

Indeed, the postgres drivers I’ve encountered are all blocking.

On this topic, a warning for anyone trying to implement async rails with postgres: beware. Connections are per-thread in the ‘pg’ gem (and every other driver I’ve used), so one client’s connection may commit/abort another client’s transaction, and they end up stomping all over each other. Which you will only observe under load.

There’s an eventmachine-based driver for postgres but it’s almost completely unmaintained afaict, and doesn’t work with any new rails versions.

I spent a ton of effort migrating an internal rails app to eventmachine, only to realize at the very end that it fundamentally doesn’t work with typical CRUD/database apps.

(Note, this experience was probably 4 or so years ago at this point, things may have matured since then, but I’d still say approach async rails with extreme caution.)

parent ninkendo 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton