The last time I tried em-synchrony, it broke dns lookup with its monkeypatching.
Is it possible to get the fiber-yielding behavior of your pg client without any of the monkeypatching ugliness of em-synchrony?
Hmm... maybe I didn't state it clearly but EM-Synchrony is optional.
You may require 'em-synchrony/pg' and benefit from fiber-aware pg driver without the need of EM-Synchrony gem.
However without em-synchrony you must remember:
to wrap EM.run with Fiber.new e.g.:
... your stuff goes here
you should also provide some kind of connection pool (you may borrow it from EM-Synchrony) for proper handling of fiber-concurrency.
My advice is to try the latest em-synchrony anyway, perhaps it's DNS issues have been resolved.
Thanks for the response. I did see em-synchrony is optional but it's not clear what you end up with when not using it. em-synchrony is just too dramatic and risky for our project. I don't like that when it (silently) fails to patch something then you get different behavior from the same API calls.
We have rack fiber pool and we also create a fiber inside every em callback, so we're always running in a yieldable fiber.
Is there code that demonstrates patching active record to use yielding calls?
Yes, there is in one of those earlier em-postgres implementations: https://github.com/leftbee/em-postgresql-adapter/blob/master/lib/active_record/connection_adapters/em_postgresql_adapter.rb
I don't use ActiveRecord myself (IMO too much unnecessary layers, I use my own ORM).
Though it would be great If you happen to adapt leftbee/em-postgresql-adapter's ActiveRecord Patch to ruby-em-pg-client. If you would contribute of course :).
I'm aware ActiveRecord is popular these days, but I don't really have the time to develop something i'm not using.