Skip to content

Sync and Async issues #2021

@LongicornYu

Description

@LongicornYu

We are using Python 3.6.10 +Gunicorn + FastAPI + SqlAlchemy ORM (similar to this approach https://fastapi.tiangolo.com/tutorial/sql-databases/)

For sync APIs, we experienced a growing memory issue as stated here #596. the memory keeps growing till the pod restart in OpenShift. (One solution is to upgrade to Python 3.8 but we need to stick with Python 3.6 for now)

If we switch all API endpoints to be under async, the growing memory issue is gone, but we experienced some issue that might be related to the comment here: #260 (comment)
As we are using SQLalchemy ORM, it doesn't support async, so essentially we are still calling everything synchronized under the async API endpoints. According to the above-linked comment, some requests might block the main thread and causing other APIs to fail.

Is switching to use SQLalchemy core to work with async APIs the only solution here?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions