Asynchronous Client

How would you go to implement an asynchronous client, say in Python 3.6 with asyncio support?

Maybe coding an async client does not make sens. WDYT?

All of the released client libraries provide an asynchronous API. I believe the Python client accomplishes this with gevent. A “modernized” Python binding with asyncio, generators, etc. sounds like a great idea!

EDIT: I take it back, these days the Python library uses the native ‘threading’ module rather than gevent.

I believe that one can set the concurrency model (to, for example, gevent) using the model parameter of fdb.open: https://apple.github.io/foundationdb/api-python.html#fdb.open

I don’t believe that asyncio is supported, but gevent is (modulo bugs).

The source code seems to think it has asyncio as an option:

elif event_model == ‘asyncio’:

(From https://github.com/apple/foundationdb/blob/master/bindings/python/fdb/impl.py)

If the documentation doesn’t say what options are valid for event_model that seems like a doc bug!

Oh, woops. So, I guess it would support asyncio, then.

My understanding is that the client of foundations can have to do a lot of computation in some cases. Think of joins for instance, or group by. So using an asynchronous client doesn’t seem like a good solution.

1 Like