Skip to content

Support for output streaming #528

@Seemone

Description

@Seemone

I'm using flask-restx in a project that deals with millions of elements in the output using SQLAlchemy as ORM. This has the side effects of flask-restx allocating many GBs of memory and having long peaks of CPU bound computation for large responses, taking tens of seconds before returning anything to the client.

While SQLAlchemy tends to fetch the whole resultset anyway lots of memory could be saved if flask-restx marshalling was done in a stream by generating and sending json elements one by one as the original list passed to marshal() is read, instead of building the whole JSON object and then send it as a whole.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions