Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention db-postgres/async-postgres in the docs #147

Open
rattrayalex opened this issue May 21, 2021 · 9 comments
Open

Mention db-postgres/async-postgres in the docs #147

rattrayalex opened this issue May 21, 2021 · 9 comments

Comments

@rattrayalex
Copy link

See this hn thread: https://news.ycombinator.com/item?id=27238671

People seem to think that threaded Rails isn't worthwhile because pg is blocking, but you have solved the problem with async-postgres (which is awesome!).

Since falcon isn't too useful with rails if you're using a blocking db driver, it might be worth mentioning their use in the rails integration guide (along with any other async versions of common libraries needed to make threaded ruby worthwhile).

@ioquatix
Copy link
Member

I have archived async-postgres and async-mysql and linked to the respective db- gems.

I'll follow up with further changes/improvements to the documentation.

@rattrayalex
Copy link
Author

Oh ok great!

@doits
Copy link

doits commented Jun 17, 2021

I just read this comment on HN:

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.

Is this a problem for falcon in combinaton with rails and the pg gem, too?

@ioquatix
Copy link
Member

I would not recommend combining AR and Falcon at this time, because AR connection state is per-thread. There is work to correct this deficiency. rails/rails#42271

I would recommend using the db gem: https://github.com/socketry/db which is as fast if not slightly more efficient than AR.

@rattrayalex
Copy link
Author

Bit of an aside, I imagine people visiting the db readme/homepage might want to be able to get an idea at a glance of how it compares to AR, or other existing gems. My impression is "it's a totally different thing: you get none of the AR abstractions, you just connect to the db and write sql" but I may be way off.

@ioquatix
Copy link
Member

For data modelling we have https://github.com/socketry/db-model I will cross link these projects. For migrations we have https://github.com/socketry/db-migrate

Both projects are immature and require more work but they both do work and I'm using them in production.

@doits
Copy link

doits commented Jun 18, 2021

I would not recommend combining AR and Falcon at this time, because AR connection state is per-thread. There is work to correct this deficiency. rails/rails#42271

I would recommend using the db gem: https://github.com/socketry/db which is as fast if not slightly more efficient than AR.

Thanks for the answer. Guess the I am not migrating a bigger legacy Rails app to falcon then yet, since I'm stuck with active record and therefore cannot use the db gems (until active record has support for them afaik).

@ioquatix
Copy link
Member

Yes, well if AR support for fibers is important you should voice your support on the relevant issue :)

@Drenmi
Copy link

Drenmi commented Aug 5, 2021

Does Falcon work well with Jeremy Evans' Sequel?

A question that's bit of an aside, but not too far off what's being discussed here. 🙂

I took a look at Sequel's default connection pool implementation, and it seems to use thread locals, which should also be fiber locals, but figured maybe someone has tried it and had proper confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants