orchestracities / ngsi-timeseries-api

QuantumLeap: a FIWARE Generic Enabler to support the usage of NGSIv2 (and NGSI-LD experimentally) data in time-series databases
https://quantumleap.rtfd.io/
MIT License
38 stars 49 forks source link

asyncpg potential #463

Open chicco785 opened 3 years ago

chicco785 commented 3 years ago

Hi @c0c0n3 and @chicco785,

first of all, I want to salute you for #450. Then, I wanted to take the chance to inform you that there is a new asyncpg release, which just happened a few hours ago, see [1]. This includes the long awaited patch for improved executemany() performance wrt. batch operations, see https://github.com/MagicStack/asyncpg/pull/295.

We are currently looking into how that can improve performance when talking to CrateDB using the PostgreSQL wire protocol. So, while I recognize QuantumLeap is still using the HTTP interface, that might well be an option to look into within a future iteration.

Whether Flask/Werkzeug will support asyncio natively is obviously the other side of the story in order to leverage most out of asyncpg. Things like [2] and [3] are obviously just workarounds and should not yet be considered for production use. Also, experiments like [4] or [5] are also, well, experimental. However, people at https://github.com/pallets/flask/issues/3339 and https://github.com/pallets/werkzeug/issues/1322 are discussing the real thing on this matter.

With kind regards, Andreas.

[1] https://github.com/MagicStack/asyncpg/releases/tag/v0.22.0 [2] https://jdhao.github.io/2020/06/07/asyncio_inside_flask/ [3] https://stackoverflow.com/questions/47841985/make-a-python-asyncio-call-from-a-flask-route [4] https://github.com/miguelgrinberg/aioflask [5] https://flask-aiohttp.readthedocs.io/

cc @mfussenegger, @seut

Originally posted by @amotl in https://github.com/orchestracities/ngsi-timeseries-api/issues/445#issuecomment-776921471

github-actions[bot] commented 3 years ago

Stale issue message