Ruby eventmachine-compatible driver (async)

84 views
Skip to first unread message

Dominik Hurnaus

unread,
Aug 30, 2017, 6:20:31 PM8/30/17
to mongodb-user

Hello,


Unfortunately, for one of our subsystems we are stuck with em-mongo (https://github.com/bcg/em-mongo), a ruby eventmachine-compatible driver for mongodb which is not being maintained since 3 years. 

Since we are planning to upgrade to 3.4 (including auth schema version 5) and this old driver is not compatible with auth schema version 5, we cannot run the upgrade right now.


Researching an alternative to em-mongo, the only thing that came up was a post by Brandon Black (10gen) from 2013, where he announced that such a driver would be available by end of 2013https://stackoverflow.com/questions/15079221/need-a-mongo-driver-that-supports-replica-sets-and-eventmachine-for-ruby


Yet, we have not found any public documentation of an eventmachine-compatible driver or any other ruby driver allowing for async (reactor-style) database calls. Can you give me a hint on where to look?

Is there any way to use the official ruby driver and run commands asynchronous?


Thanks for your help!


Dominik

Emily S

unread,
Sep 6, 2017, 11:14:51 AM9/6/17
to mongodb-user

Hi Dominik


I'm not an expert on eventmachine - is there a way to use it with the MongoDB Ruby driver as-is? I know there are a number of users successfully using sidekiq and our driver.


If there is a technical limitation of using eventmachine with the MongoDB Ruby driver, I'd be interested to hear about so I can see if there's anything we can do to provide compatibility.


Thanks

Emily

Dominik Hurnaus

unread,
Sep 9, 2017, 1:36:59 PM9/9/17
to mongodb-user
Hi Emily,

The ruby eventmachine (https://github.com/eventmachine/eventmachine) offers an event machine following the reactor pattern - whenever I/O intensive operations (network, disk, db,...) are accessed, those are done asynchronously and the result of those operations can then be accessed in callback methods. Having the ability to run database queries (find, insert, update) asynchronously would already go the first 80% of the way to make it eventmachine-compatible (we could build an eventmachine-compatible wrapper around the asynchronous driver).

We could essentially use the driver as is - but this would completely undermine the eventmachines reactive behavior (if we would not hand over control to the event machine once we make calls against the database).

Thanks,

Dominik
Reply all
Reply to author
Forward
0 new messages