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

Provide an async implementation #74

Open
ggreg opened this issue Feb 15, 2019 · 3 comments
Open

Provide an async implementation #74

ggreg opened this issue Feb 15, 2019 · 3 comments

Comments

@ggreg
Copy link
Contributor

ggreg commented Feb 15, 2019

The current interface returns a generator of result rows and is mostly used synchronously. Leveraging async in Python 3 would allow to better utilize resources when managing parallel and concurrent queries.

One challenge is to keep compatibility with Python 2.7.

@jaredvacanti
Copy link

Is current best practice to use an asyncio executor when using presto-python-client in existing asynchronous applications? Are there alternative methods?

@ggreg
Copy link
Contributor Author

ggreg commented Jun 28, 2019

We usually rely on a plain concurrent.futures.Executor to execute concurrent Presto queries.

Are you talking about using https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor with a concurrent.futures.Executor to do Presto queries along async code?

We'd like to move to actually use async to support higher concurrent with a lower CPU and memory footprint for some application such as shadowing queries where we run the service with hundred of processes (which has a cost in memory usage as copy-on-write when forking processes tend to still copy a lot of pages with typical Python processes). There's also context switching between threads or processes and everything else that would be better with coroutines.

@dchimeno
Copy link

Is something planned related to support async execution?

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

No branches or pull requests

3 participants